aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server.cpp')
-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("");