parse: Add some bounds checking
authorDavid Schleef <ds@schleef.org>
Sun, 5 Sep 2010 19:57:56 +0000 (12:57 -0700)
committerDavid Schleef <ds@schleef.org>
Sun, 5 Sep 2010 19:57:56 +0000 (12:57 -0700)
orc/orcparse.c

index 88bb712eade3c62e9f3f21245fd5f0d3446c55f8..98cb6db41ccc245446f224130caea0a61f6ebcf8 100644 (file)
@@ -259,7 +259,9 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log)
   } else {
     free (parser->log);
   }
-  parser->programs[0]->init_function = init_function;
+  if (parser->programs[0]) {
+    parser->programs[0]->init_function = init_function;
+  }
   *programs = parser->programs;
   return parser->n_programs;
 }