summaryrefslogtreecommitdiff
path: root/sci_gateway
diff options
context:
space:
mode:
authordetailer2021-05-12 21:45:09 +0530
committerdetailer2021-05-12 21:45:09 +0530
commit436d0709245aa838b8a66b12adfd218862e8bf18 (patch)
treec71d30afc9634a3b08dd2c430c27cf10ababd899 /sci_gateway
parentd8bc1ab06ffaa8644c16f01c22a9d3df6b5ede1e (diff)
downloadfossee-scilab-octave-toolbox-436d0709245aa838b8a66b12adfd218862e8bf18.tar.gz
fossee-scilab-octave-toolbox-436d0709245aa838b8a66b12adfd218862e8bf18.tar.bz2
fossee-scilab-octave-toolbox-436d0709245aa838b8a66b12adfd218862e8bf18.zip
fixed empty structure input crash
Diffstat (limited to 'sci_gateway')
-rw-r--r--sci_gateway/cpp/sci_octave.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/sci_gateway/cpp/sci_octave.cpp b/sci_gateway/cpp/sci_octave.cpp
index 1ccda51..817c184 100644
--- a/sci_gateway/cpp/sci_octave.cpp
+++ b/sci_gateway/cpp/sci_octave.cpp
@@ -159,7 +159,10 @@ extern "C"
scilabVar struct_out;
int dims = 0;
- dims = scilab_getFields(env, in[i], &keys); // Retrieving Struct Keys
+ // call getfields only when struct is not empty else getfields will crash
+ if(scilab_isEmpty(env, in[i]) != 1){
+ dims = scilab_getFields(env, in[i], &keys); // Retrieving Struct Keys
+ }
ins[i].n_in_struct_len = dims;
//std::cout<<dims<<std::endl;