Fix some null argument issues.

This commit is contained in:
Bill Currie 2018-09-07 22:30:44 +09:00
parent 1eb1622420
commit f75ff2d269
2 changed files with 5 additions and 1 deletions

View file

@ -106,7 +106,7 @@ COM_InitArgv (int argc, const char **argv)
largv[com_argc] = argv[com_argc];
if ((argv[com_argc]) && !strcmp ("-safe", argv[com_argc]))
safe = true;
if (com_argc)
if (argv[com_argc])
len += strlen (argv[com_argc]) + 1;
}

View file

@ -55,6 +55,7 @@
#include "QF/dstring.h"
#include "cpp.h"
#include "diagnostic.h"
#include "options.h"
typedef struct cpp_arg_s {
@ -205,6 +206,9 @@ preprocess_file (const char *filename, const char *ext)
if (cpp_name) {
intermediate_file (tempname, filename, ext ? ext : "p", 0);
build_cpp_args (filename, tempname->str);
if (!cpp_argv[0]) {
internal_error(0, "cpp_argv[0] is null");
}
#ifdef _WIN32
if (!options.save_temps && !options.preprocess_only)