Skip to content

Commit b411efa

Browse files
amai2012danmar
authored andcommitted
Fixed danmar#5302 (Invalid parameter for --showtime should cause an error)
1 parent f93d21c commit b411efa

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

cli/cmdlineparser.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,15 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[])
593593
_settings->_showtime = SHOWTIME_SUMMARY;
594594
else if (showtimeMode == "top5")
595595
_settings->_showtime = SHOWTIME_TOP5;
596-
else
596+
else if (showtimeMode.empty())
597597
_settings->_showtime = SHOWTIME_NONE;
598+
else {
599+
std::string message("cppcheck: error: unrecognized showtime mode: \"");
600+
message += showtimeMode;
601+
message += "\".";
602+
PrintMessage(message);
603+
return false;
604+
}
598605
}
599606

600607
#ifdef HAVE_RULES

0 commit comments

Comments
 (0)