aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluk3yx <luk3yx@users.noreply.github.com>2023-03-20 08:23:11 +1300
committerGitHub <noreply@github.com>2023-03-19 20:23:11 +0100
commit5fa63a0b0c6ed6c459d41c3d00d43740439db0d3 (patch)
tree9837b69444c0f4bb8b18c6724f00ae21899cdf55 /src
parent6fe9bc8ae1ccbfdd0f5f050f46b55decc1b90520 (diff)
downloadminetest-5fa63a0b0c6ed6c459d41c3d00d43740439db0d3.tar.xz
Fix server-side formspec state keeping issue (#13332)
Diffstat (limited to 'src')
-rw-r--r--src/server.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/server.cpp b/src/server.cpp
index 9e2ea8640..1ee623fa0 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1539,10 +1539,13 @@ void Server::SendShowFormspecMessage(session_t peer_id, const std::string &forms
{
NetworkPacket pkt(TOCLIENT_SHOW_FORMSPEC, 0, peer_id);
if (formspec.empty()){
- //the client should close the formspec
- //but make sure there wasn't another one open in meantime
+ // The client should close the formspec
+ // But make sure there wasn't another one open in meantime
+ // If the formname is empty, any open formspec will be closed so the
+ // form name should always be erased from the state.
const auto it = m_formspec_state_data.find(peer_id);
- if (it != m_formspec_state_data.end() && it->second == formname) {
+ if (it != m_formspec_state_data.end() &&
+ (it->second == formname || formname.empty())) {
m_formspec_state_data.erase(peer_id);
}
pkt.putLongString("");