fix arg parsing segfault (#595)
This commit is contained in:
parent
13be546dc3
commit
0a32023aac
@ -37,14 +37,14 @@ int main(int argc, char *argv[]) {
|
|||||||
for (; !res && i < argc; i++) {
|
for (; !res && i < argc; i++) {
|
||||||
if (argv[i][0] != '-') break;
|
if (argv[i][0] != '-') break;
|
||||||
if (argv[i] == std::string("-o")) {
|
if (argv[i] == std::string("-o")) {
|
||||||
if (i++ < argc) {
|
if (++i < argc) {
|
||||||
format = argv[i];
|
format = argv[i];
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "error: -o requires format value" << std::endl;
|
std::cerr << "error: -o requires format value" << std::endl;
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
} else if (argv[i] == std::string("-p")) {
|
} else if (argv[i] == std::string("-p")) {
|
||||||
if (i++ < argc) {
|
if (++i < argc) {
|
||||||
options.emplace_back(argv[i]);
|
options.emplace_back(argv[i]);
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "error: -p requires parameter value" << std::endl;
|
std::cerr << "error: -p requires parameter value" << std::endl;
|
||||||
|
Loading…
Reference in New Issue
Block a user