mirror of
https://github.com/aristocratos/btop.git
synced 2026-04-18 22:22:02 -04:00
Exit gracefully if integer conversion in CLI parser fails
This commit is contained in:
@@ -124,6 +124,9 @@ namespace Cli {
|
||||
} catch (std::invalid_argument& e) {
|
||||
error("Preset must be a positive number");
|
||||
return OrRetCode { 1 };
|
||||
} catch (std::out_of_range& e) {
|
||||
error(fmt::format("Preset argument is out of range: {}", arg.data()));
|
||||
return OrRetCode { 1 };
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -141,6 +144,9 @@ namespace Cli {
|
||||
} catch (std::invalid_argument& e) {
|
||||
error("Update must be a positive number");
|
||||
return OrRetCode { 1 };
|
||||
} catch(std::out_of_range& e) {
|
||||
error(fmt::format("Update argument is out of range: {}", arg.data()));
|
||||
return OrRetCode { 1 };
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user