Commit bd485b59 authored by nkshigeru's avatar nkshigeru

avoid passing NULL to fopen

parent d65542cc
...@@ -105,7 +105,8 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args) ...@@ -105,7 +105,8 @@ parse_args(mrb_state *mrb, int argc, char **argv, struct _args *args)
} }
if (args->rfp == NULL && args->cmdline == NULL && (args->rfp = fopen(*argv, args->mrbfile ? "rb" : "r")) == NULL) { if (args->rfp == NULL && args->cmdline == NULL &&
(*argv == NULL || (args->rfp = fopen(*argv, args->mrbfile ? "rb" : "r")) == NULL)) {
printf("%s: Cannot open program file. (%s)\n", *origargv, *argv); printf("%s: Cannot open program file. (%s)\n", *origargv, *argv);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment