Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 5c9d2cf0 authored by hhakim's avatar hhakim
Browse files

Fix bug. Prevent save of empty Faust.

parent 9fa87a55
No related branches found
No related tags found
No related merge requests found
...@@ -255,13 +255,14 @@ void Faust::Transform<FPP, Cpu>::save_mat_file(const char* filename, bool transp ...@@ -255,13 +255,14 @@ void Faust::Transform<FPP, Cpu>::save_mat_file(const char* filename, bool transp
size_t dims[2]; size_t dims[2];
int i, i2, ret; int i, i2, ret;
mat_t *matfp; mat_t *matfp;
if(!size()) handleError("Faust::Transform", "save_mat_file(): can't save an empty Faust.");
matvar_t **faust_factor_matvars = new matvar_t*[size()]; matvar_t **faust_factor_matvars = new matvar_t*[size()];
for(i=0; i < size(); i++){ for(i=0; i < size(); i++){
// revert factors order if we are in transpose case // revert factors order if we are in transpose case
i2 = transpose?size()-i-1:i; i2 = transpose?size()-i-1:i;
faust_factor_matvars[i] = data[i2]->toMatIOVar(transpose, conjugate); faust_factor_matvars[i] = data[i2]->toMatIOVar(transpose, conjugate);
if(faust_factor_matvars[i] == NULL) if(faust_factor_matvars[i] == NULL)
handleError("Faust::Transform", "Failed to create i-th factor MatIO variable"); handleError("Faust::Transform", "save_mat_file(): failed to create i-th factor MatIO variable");
} }
// write the faust cell array // write the faust cell array
dims[0] = 1; dims[0] = 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment