aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index f1fbe8668..41ac87527 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1577,7 +1577,11 @@ 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
- m_formspec_state_data.erase(peer_id);
+ //but make sure there wasn't another one open in meantime
+ const auto it = m_formspec_state_data.find(peer_id);
+ if (it != m_formspec_state_data.end() && it->second == formname) {
+ m_formspec_state_data.erase(peer_id);
+ }
pkt.putLongString("");
} else {
m_formspec_state_data[peer_id] = formname;