Skip to content

Commit 5b6d516

Browse files
authored
Merge pull request #1112 from YcKe/master
Allow empty UserVariables for string values
2 parents a71dd43 + 288275c commit 5b6d516

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

main/WebServer.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,11 @@ namespace http {
16911691
std::string variablename = request::findValue(&req, "vname");
16921692
std::string variablevalue = request::findValue(&req, "vvalue");
16931693
std::string variabletype = request::findValue(&req, "vtype");
1694-
if ((variablename == "") || (variablevalue == "") || (variabletype == ""))
1694+
if (
1695+
(variablename == "") ||
1696+
(variabletype == "") ||
1697+
((variablevalue == "") && (variabletype != "2"))
1698+
)
16951699
return;
16961700

16971701
root["status"] = m_sql.SaveUserVariable(variablename, variabletype, variablevalue);
@@ -1721,7 +1725,12 @@ namespace http {
17211725
idx = result[0][0];
17221726
}
17231727

1724-
if (idx.empty() || variablename.empty() || variablevalue.empty() || variabletype.empty())
1728+
if (
1729+
(idx.empty()) ||
1730+
(variablename.empty()) ||
1731+
(variabletype.empty()) ||
1732+
((variablevalue.empty()) && (variabletype != "2"))
1733+
)
17251734
return;
17261735

17271736
root["status"] = m_sql.UpdateUserVariable(idx, variablename, variabletype, variablevalue, true);

0 commit comments

Comments
 (0)