if the variable does not exist then an error message to indicate this 05/16505/2
Sylvain GENIN [Mon, 25 May 2015 13:51:46 +0000 (15:51 +0200)]
test_run("io","bug_11997",["no_check_error_output" ]);

Change-Id: I8e434ebe943dab0ee7781f0ebde56a9d8f60d047

scilab/modules/io/sci_gateway/c/sci_save.c

index 29ae2a6..e8b57f8 100644 (file)
@@ -78,8 +78,15 @@ int sci_save(char *fname, void *pvApiCtx)
                     //try to get variable by name
                     sciErr = getVarAddressFromName(pvApiCtx, pstVarI, &piAddrI2);
                     freeAllocatedSingleString(pstVarI);
+
+                    if (sciErr.iErr != 0)
+                    {
+                        Scierror(999, _("Wrong value for argument #%d: Valid variable name expected.\n"), 3);
+                        return 1;
+                    }
+
                     pstVarI = NULL;
-                    if (sciErr.iErr || piAddrI2 == NULL)
+                    if (piAddrI2 == NULL)
                     {
                         // Try old save because here the input variable can be of type "string" but not a variable name
                         // Ex: a=""; save(filename, a);