diff --git a/passes/silimate/report_fanout.cc b/passes/silimate/report_fanout.cc index a4f6073b4..a5f5d562c 100644 --- a/passes/silimate/report_fanout.cc +++ b/passes/silimate/report_fanout.cc @@ -226,7 +226,11 @@ struct ReportFanoutPass : public Pass { for (argidx = 1; argidx < args.size(); argidx++) { if (args[argidx] == "-limit" && argidx + 1 < args.size()) { - limit = std::stoi(args[++argidx]); + try { + limit = std::stoi(args[++argidx]); + } catch (...) { + log_cmd_error("Invalid value for -limit: '%s'. Expected an integer.\n", args[argidx].c_str()); + } continue; } if (args[argidx] == "-file" && argidx + 1 < args.size()) {