Skip to content

Commit 7dbd173

Browse files
authored
Merge pull request #160 from zhaozhiwen/fix/121-help-no-topic
Do not crash on "gemc help" with no topic
2 parents 021367d + 1dbb600 commit 7dbd173

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

gemc/goptions/goptions.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ GOptions::GOptions(int argc, char* argv[], const GOptions& user_defined_options)
100100
exit(EXIT_SUCCESS);
101101
}
102102
else if (strcmp(argv[i], "help") == 0) {
103-
printOptionOrSwitchHelp(argv[i + 1]);
103+
// "gemc help <topic>" shows topic help; bare "gemc help" shows the general help index.
104+
if (i + 1 < argc) { printOptionOrSwitchHelp(argv[i + 1]); }
105+
else { printHelp(); }
104106
exit(EXIT_SUCCESS);
105107
}
106108
}

0 commit comments

Comments
 (0)