fix: make ui binds work without args

This commit is contained in:
Jan Laupetin
2025-10-10 09:49:40 +02:00
parent 210941991e
commit 8e9358b07f
+15 -3
View File
@@ -33,7 +33,11 @@ namespace ui
con::error("Webview params are not an array: {}", req); con::error("Webview params are not an array: {}", req);
return ""; return "";
} }
param = json.at(0).get<TInput>();
if (json.empty())
param = nlohmann::json().get<TInput>();
else
param = json.at(0).get<TInput>();
} }
catch (const nlohmann::json::exception& e) catch (const nlohmann::json::exception& e)
{ {
@@ -71,7 +75,11 @@ namespace ui
con::error("Webview params are not an array: {}", req); con::error("Webview params are not an array: {}", req);
return ""; return "";
} }
param = json.at(0).get<TInput>();
if (json.empty())
param = nlohmann::json().get<TInput>();
else
param = json.at(0).get<TInput>();
} }
catch (const nlohmann::json::exception& e) catch (const nlohmann::json::exception& e)
{ {
@@ -110,7 +118,11 @@ namespace ui
con::error("Webview params are not an array: {}", req); con::error("Webview params are not an array: {}", req);
return ""; return "";
} }
param = json.at(0).get<TInput>();
if (json.empty())
param = nlohmann::json().get<TInput>();
else
param = json.at(0).get<TInput>();
} }
catch (const nlohmann::json::exception& e) catch (const nlohmann::json::exception& e)
{ {