Skip to content

Commit

Permalink
Update confighttp.cpp
Browse files Browse the repository at this point in the history
Co-Authored-By: Lukas Senionis <[email protected]>
  • Loading branch information
ReenigneArcher and FrogTheFrog committed Jan 10, 2025
1 parent 1394bbc commit 7b65727
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/confighttp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,13 +618,12 @@ namespace confighttp {
auto &apps_node = fileTree.get_child("apps"s);
int index = stoi(request->path_match[1]);

std::string error;
if (index < 0 || index >= static_cast<int>(apps_node.size())) {
int max_index = apps_node.size() - 1;
if (max_index < 0) {
std::string error;
if (const int max_index = static_cast<int>(apps_node.size()) - 1; max_index < 0) {
error = "No applications to delete";
} else {
error = "index out of range, max index is "s + std::to_string(max_index);
error = "'index' out of range, max index is "s + std::to_string(max_index);
}
bad_request(response, request, error);
return;
Expand Down

0 comments on commit 7b65727

Please sign in to comment.