summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/resources/chatobject.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/resources/chatobject.cpp b/src/resources/chatobject.cpp
index a3582e3d6..0c617f6dc 100644
--- a/src/resources/chatobject.cpp
+++ b/src/resources/chatobject.cpp
@@ -38,10 +38,10 @@ ChatObject::ChatObject() :
ChatObject::~ChatObject()
{
std::map<std::string, ChatObject*>::iterator it = chatNameMap.find(title);
- if (it != chatNameMap.end())
+ if (it != chatNameMap.end() && (*it).second == this)
chatNameMap.erase(it);
std::map<int, ChatObject*>::iterator it2 = chatIdMap.find(chatId);
- if (it2 != chatIdMap.end())
+ if (it2 != chatIdMap.end() && (*it2).second == this)
chatIdMap.erase(it2);
}