Fix null deref where argc = 0

I noticed this on the Wii U emulator Decaf - it sets argc to 0 and,
annoyingly, sets up argv so that argv[0] is a bad read.

Gah.
This commit is contained in:
Ash 2017-08-19 17:16:50 +10:00
parent 7d259b4eaa
commit 738d17ff3b
No known key found for this signature in database
GPG Key ID: F8C85A8C836C0A7E

View File

@ -184,7 +184,7 @@ int getopt_long(int argc, char *argv[],
if (optind == 0)
optind = 1;
if (argc == 1)
if (argc < 2)
return -1;
short_index = find_short_index(&argv[optind]);