mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 04:25:58 +01:00
protect stoi
This commit is contained in:
parent
e499411123
commit
1640958e37
2 changed files with 11 additions and 2 deletions
|
@ -353,7 +353,12 @@ int main(int argc, char** argv) {
|
|||
fullArgs += "f";
|
||||
needRoll = true;
|
||||
if (ARGS.size() >= 3)
|
||||
rollRate = std::stoi(ARGS[2]);
|
||||
try {
|
||||
rollRate = std::stoi(ARGS[2]);
|
||||
} catch (std::invalid_argument& e) {
|
||||
log("invalid argument\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (ARGS[i] == "--batch") {
|
||||
fullRequest = "--batch ";
|
||||
} else if (ARGS[i] == "--instance" || ARGS[i] == "-i") {
|
||||
|
|
|
@ -1829,7 +1829,11 @@ int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
|
|||
std::string val;
|
||||
if (iss >> val) {
|
||||
if (iss >> val) {
|
||||
runWritingDebugLogThread(ACCEPTEDCONNECTION, std::stoi(val));
|
||||
try {
|
||||
runWritingDebugLogThread(ACCEPTEDCONNECTION, std::stoi(val));
|
||||
} catch (std::invalid_argument& e) {
|
||||
Debug::log(ERR, "Error in rollinglog request: {}", e.what());
|
||||
}
|
||||
} else {
|
||||
runWritingDebugLogThread(ACCEPTEDCONNECTION);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue