Add test for PERMISSIONS with bad syntax
[pspp] / src / language / lexer / lexer.c
index 1f455119f00b1779f51787d54dedf4b469c46b1b..08d35d8c00312d98d2baeb7e80ff04141037b9f9 100644 (file)
@@ -604,9 +604,16 @@ lex_force_match (struct lexer *lexer, enum token_type type)
     }
   else
     {
-      char *s = xasprintf ("`%s'", token_type_to_string (type));
-      lex_error_expecting (lexer, s, NULL_SENTINEL);
-      free (s);
+      const char *type_string = token_type_to_string (type);
+      if (type_string)
+       {
+         char *s = xasprintf ("`%s'", type_string);
+         lex_error_expecting (lexer, s, NULL_SENTINEL);
+         free (s);
+       }
+      else
+       lex_error_expecting (lexer, token_type_to_name (type), NULL_SENTINEL);
+      
       return false;
     }
 }