main: fix segfault when -c is given with no other arguments (#2470)

This commit is contained in:
eriedaberrie 2023-06-09 03:15:18 -07:00 committed by GitHub
parent 7f753cab9a
commit d123835ef5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,7 +51,7 @@ int main(int argc, char** argv) {
ignoreSudo = true;
} else if (it->compare("-c") == 0 || it->compare("--config") == 0) {
if (std::next(it)->c_str() == nullptr) {
if (std::next(it) == args.end()) {
help();
return 1;
}