From 8e9358b07f6fe9b290f27f8961b5ba8778de7cfb Mon Sep 17 00:00:00 2001 From: Jan Laupetin Date: Thu, 9 Oct 2025 22:42:43 +0100 Subject: [PATCH] fix: make ui binds work without args --- src/ModMan/Web/UiCommunication.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ModMan/Web/UiCommunication.h b/src/ModMan/Web/UiCommunication.h index f5f7c2c3..840d6bcf 100644 --- a/src/ModMan/Web/UiCommunication.h +++ b/src/ModMan/Web/UiCommunication.h @@ -33,7 +33,11 @@ namespace ui con::error("Webview params are not an array: {}", req); return ""; } - param = json.at(0).get(); + + if (json.empty()) + param = nlohmann::json().get(); + else + param = json.at(0).get(); } catch (const nlohmann::json::exception& e) { @@ -71,7 +75,11 @@ namespace ui con::error("Webview params are not an array: {}", req); return ""; } - param = json.at(0).get(); + + if (json.empty()) + param = nlohmann::json().get(); + else + param = json.at(0).get(); } catch (const nlohmann::json::exception& e) { @@ -110,7 +118,11 @@ namespace ui con::error("Webview params are not an array: {}", req); return ""; } - param = json.at(0).get(); + + if (json.empty()) + param = nlohmann::json().get(); + else + param = json.at(0).get(); } catch (const nlohmann::json::exception& e) {