]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - test.c
cppcheck had the right idea, but the wrong scope on this one.
[xonotic/gmqcc.git] / test.c
diff --git a/test.c b/test.c
index 1ebb33a55b4f95222d86158ba3f14d5b97018e63..5f7eac7c83e948b141d314f658d2005e66479486 100644 (file)
--- a/test.c
+++ b/test.c
@@ -325,6 +325,8 @@ static bool task_template_generate(task_template_t *tmpl, char tag, const char *
      */
     if (value && *value && (*value == ' ' || *value == '\t'))
         value++;
+    else if (!value)
+        exit(EXIT_FAILURE);
 
     /*
      * Value will contain a newline character at the end, we need to strip
@@ -332,8 +334,6 @@ static bool task_template_generate(task_template_t *tmpl, char tag, const char *
      */
     if (strchr(value, '\n'))
         *strrchr(value, '\n')='\0';
-    else /* cppcheck: possible nullpointer dereference */
-        exit(EXIT_FAILURE);
 
     /*
      * Now allocate and set the actual value for the specific tag. Which