]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
cppcheck had the right idea, but the wrong scope on this one.
authorDale Weiler <killfieldengine@gmail.com>
Fri, 21 Jun 2013 23:29:50 +0000 (23:29 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Fri, 21 Jun 2013 23:29:50 +0000 (23:29 +0000)
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