bring back error checking removed by https://codereview.scilab.org/#/c/16673/
[scilab.git] / scilab / modules / graphics / src / c / getHandleProperty / get_mark_foreground_property.c
index 99c436b..79c42d2 100644 (file)
@@ -41,17 +41,23 @@ int get_mark_foreground_property(void* _pvCtx, int iObjUID)
     int numMarkForegrounds = 0;
     int * piNumMarkForegrounds = &numMarkForegrounds;
 
-       getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_FOREGROUNDS__, jni_int, (void**)&piNumMarkForegrounds);
-
-       if (numMarkForegrounds == 0)
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUND__, jni_int, &piMarkForeground);
-               return sciReturnDouble(_pvCtx, iMarkForeground);
-       }
-       else
-       {
-               getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUNDS__, jni_int_vector, &markForegrounds);
-               return sciReturnRowVectorFromInt(_pvCtx, markForegrounds, numMarkForegrounds);
-       }
+    getGraphicObjectProperty(iObjUID, __GO_NUM_MARK_FOREGROUNDS__, jni_int, (void**)&piNumMarkForegrounds);
+
+    if (piNumMarkForegrounds == NULL)
+    {
+        Scierror(999, _("'%s' property does not exist for this handle.\n"), "mark_foreground");
+        return -1;
+    }
+
+    if (numMarkForegrounds == 0)
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUND__, jni_int, &piMarkForeground);
+        return sciReturnDouble(_pvCtx, iMarkForeground);
+    }
+    else
+    {
+        getGraphicObjectProperty(iObjUID, __GO_MARK_FOREGROUNDS__, jni_int_vector, &markForegrounds);
+        return sciReturnRowVectorFromInt(_pvCtx, markForegrounds, numMarkForegrounds);
+    }
 }
 /*------------------------------------------------------------------------*/