extract : a(-1) must return a error 98/16898/2
Antoine ELIAS [Mon, 27 Jul 2015 09:09:52 +0000 (11:09 +0200)]
Change-Id: I89d5491f7b0d1ab51173b2ea2e62e4e5c6fc4c9e

scilab/modules/ast/src/cpp/types/arrayof.cpp

index 16b03e7..bef7f3e 100644 (file)
@@ -978,12 +978,17 @@ InternalType* ArrayOf<T>::extract(typed_list* _pArgs)
     int index;
     if (getScalarIndex(this, _pArgs, &index))
     {
+        if (index < 0)
+        {
+            return NULL;
+        }
+
         if (getSize() == 0)
         {
             return createEmpty();
         }
 
-        if (index < 0 || index >= getSize())
+        if (index >= getSize())
         {
             return NULL;
         }