IO src: fix CID 1366882 81/18781/2
Paul Bignier [Fri, 9 Dec 2016 08:12:05 +0000 (09:12 +0100)]
Change-Id: I5d7a4fe5ce12b56008acef9a5a0a013ada4b3f9f

scilab/modules/io/sci_gateway/cpp/sci_genlib.cpp

index 1dcd01e..2285824 100644 (file)
@@ -222,12 +222,12 @@ types::Function::ReturnValue sci_genlib(types::typed_list &in, int _iRetCount, t
 
 
     wchar_t **pstPath = findfilesW(pstParsePath, L"*.sci", &iNbFile, FALSE);
-    // sort by name using C-style functions
-    qsort(pstPath, iNbFile, sizeof(wchar_t*), cmp);
-
 
     if (pstPath)
     {
+        // sort by name using C-style functions
+        qsort(pstPath, iNbFile, sizeof(wchar_t*), cmp);
+
         types::Library* pLib = new types::Library(pstParsePath);
         for (int k = 0 ; k < iNbFile ; k++)
         {