[common] option: fix invalid access of null/invalid options
This commit is contained in:
1 parent
2d5f6d65ce
commit
06c229dfd4
2 files changed
+6
-7
No files matched your search
+5
-6
@@ -267,15 +267,14 @@ bool option_parse(int argc, char * argv[])
|
||||
if (state.options[i]->shortopt == argv[a][1])
|
||||
{
|
||||
o = state.options[i];
|
||||
if (o->type != OPTION_TYPE_BOOL && a < argc - 1)
|
||||
{
|
||||
++a;
|
||||
value = strdup(argv[a]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (o->type != OPTION_TYPE_BOOL && a < argc - 1)
|
||||
{
|
||||
++a;
|
||||
value = strdup(argv[a]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user