]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.c
Fixing uninitialized warnings in parser.c
[xonotic/gmqcc.git] / parser.c
index 4058a8f99b042c349cfa54fa3aa89717121a2fb3..a11c70955878c248adbef9c0bd7b48307abaafd2 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -2512,11 +2512,6 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou
     while (parser->tok != '}') {
         ast_block *caseblock;
 
-        if (parser->tok != TOKEN_KEYWORD) {
-            ast_delete(switchnode);
-            parseerror(parser, "expected 'case' or 'default'");
-            return false;
-        }
         if (!strcmp(parser_tokval(parser), "case")) {
             if (!parser_next(parser)) {
                 ast_delete(switchnode);
@@ -2545,6 +2540,11 @@ static bool parse_switch(parser_t *parser, ast_block *block, ast_expression **ou
                 return false;
             }
         }
+        else {
+            ast_delete(switchnode);
+            parseerror(parser, "expected 'case' or 'default'");
+            return false;
+        }
 
         /* Now the colon and body */
         if (parser->tok != ':') {