diff --git a/src/main.cpp b/src/main.cpp index 766ba97..3476398 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -64,7 +64,7 @@ void parseArgument(const string& arg, int &dayNum, bool &useTestInput, int &test } dayNum = stoi(arg.substr(0, tIndex)); useTestInput = true; - testFetchIndex = stoi(arg.substr(tIndex + 1)); + testFetchIndex = tIndex + 1 < arg.size() ? stoi(arg.substr(tIndex + 1)) : 0; } int main(int argc, char *argv[]) {