From 7b657275a3e056799d167b26f9d31087731548eb Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:31:05 -0500 Subject: [PATCH] Update confighttp.cpp Co-Authored-By: Lukas Senionis <22381748+FrogTheFrog@users.noreply.github.com> --- src/confighttp.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/confighttp.cpp b/src/confighttp.cpp index 82a9b4dc07f..a7254f37cd8 100644 --- a/src/confighttp.cpp +++ b/src/confighttp.cpp @@ -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(apps_node.size())) { - int max_index = apps_node.size() - 1; - if (max_index < 0) { + std::string error; + if (const int max_index = static_cast(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;