Coverity #1321160 fixed 13/18513/1
Dhruv Khattar [Thu, 25 Aug 2016 11:40:26 +0000 (16:40 +0530)]
Change-Id: Iff356764402f1b89ca749f9cea5734a9caec07dc

scilab/modules/xml/sci_gateway/cpp/sci_xmlWrite.cpp

index 4bae2d5..95ce53a 100644 (file)
@@ -165,6 +165,12 @@ int sci_xmlWrite(char *fname, void* pvApiCtx)
         expandedPath = os_strdup((const char *)document->URL);
     }
 
+    if (expandedPath == NULL)
+    {
+        Scierror(999, gettext("%s: Cannot write the file.\n"), fname);
+        return 0;
+    }
+
     if (!doc->saveToFile(expandedPath, indent == 1))
     {
         Scierror(999, gettext("%s: Cannot write the file: %s\n"), fname, expandedPath);