]> granicus.if.org Git - graphviz/commitdiff
In string-to-int conversion, handle possibility that a NULL string,
authorerg <devnull@localhost>
Tue, 22 Jul 2008 15:28:47 +0000 (15:28 +0000)
committererg <devnull@localhost>
Tue, 22 Jul 2008 15:28:47 +0000 (15:28 +0000)
generated internally, may have to be handled.

lib/expr/exeval.c

index fd174d9a28c3e744ae4ae2c0902adda840b68d95..88163ea37554d4d7842db2a92624622a6c1185f2 100644 (file)
@@ -1619,9 +1619,13 @@ static Extype_t eval(Expr_t * ex, register Exnode_t * expr, void *env)
                                       data.operand.right->data.variable.
                                       symbol : (Exid_t *) 0, 0,
                                       ex->disc)) {
-               tmp.data.constant.value.integer = strToL(v.string, &e);
-               if (*e)
-                   tmp.data.constant.value.integer = *v.string != 0;
+               if (v.string) {
+                   tmp.data.constant.value.integer = strToL(v.string, &e);
+                   if (*e)
+                       tmp.data.constant.value.integer = *v.string != 0;
+               }
+               else
+                   tmp.data.constant.value.integer = 0;
            }
            tmp.type = INTEGER;
            return tmp.data.constant.value;