Fix calls to `substr` with invalid `pos`

This commit is contained in:
bazuin-32 2022-07-12 15:38:50 -06:00
parent 4bea3467e0
commit ac9ff795cd
1 changed files with 2 additions and 1 deletions

View File

@ -526,7 +526,8 @@ std::string getReply(std::string request) {
format = HyprCtl::FORMAT_JSON;
}
request = request.substr(sepIndex + 1); // remove flags and separator so we can compare the rest of the string
if (sepIndex < request.size())
request = request.substr(sepIndex + 1); // remove flags and separator so we can compare the rest of the string
if (request == "monitors")
return monitorsRequest(format);