projects
/
platform
/
upstream
/
orc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f088b22
)
parse: check for empty source file
author
David Schleef
<ds@schleef.org>
Sun, 2 Oct 2011 23:25:22 +0000
(16:25 -0700)
committer
David Schleef
<ds@schleef.org>
Sun, 2 Oct 2011 23:25:22 +0000
(16:25 -0700)
orc/orcparse.c
patch
|
blob
|
history
tools/orcc.c
patch
|
blob
|
history
diff --git
a/orc/orcparse.c
b/orc/orcparse.c
index
00056c3
..
ea17c13
100644
(file)
--- a/
orc/orcparse.c
+++ b/
orc/orcparse.c
@@
-324,7
+324,7
@@
orc_parse_full (const char *code, OrcProgram ***programs, char **log)
} else {
free (parser->log);
}
- if (parser->programs[0]) {
+ if (parser->programs
&& parser->programs
[0]) {
parser->programs[0]->init_function = init_function;
} else {
free (init_function);
diff --git
a/tools/orcc.c
b/tools/orcc.c
index
35dab6b
..
9766d02
100644
(file)
--- a/
tools/orcc.c
+++ b/
tools/orcc.c
@@
-227,6
+227,11
@@
main (int argc, char *argv[])
n_programs = n;
printf("%s", log);
+ if (programs == NULL) {
+ printf("no programs\n");
+ exit(1);
+ }
+
if (init_function == NULL) {
init_function = orc_parse_get_init_function (programs[0]);
}