summaryrefslogtreecommitdiff
path: root/src/map/chat.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-08 13:15:35 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-10-08 13:15:35 +0000
commitd530df5b85eb2f796fd51ae1fe3bdce843d9ca00 (patch)
treec504b3044b9f1dd6618449af701469a744465826 /src/map/chat.c
parente98cb15c72c5a4cee3b7658b139504a8aa9c3a75 (diff)
downloadhercules-d530df5b85eb2f796fd51ae1fe3bdce843d9ca00.tar.gz
hercules-d530df5b85eb2f796fd51ae1fe3bdce843d9ca00.tar.bz2
hercules-d530df5b85eb2f796fd51ae1fe3bdce843d9ca00.tar.xz
hercules-d530df5b85eb2f796fd51ae1fe3bdce843d9ca00.zip
Fixed chat_createnpcchat() not checking if a chatroom already exists, producing memleaks in certain situations (bugreport:2325).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13269 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/chat.c')
-rw-r--r--src/map/chat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index a466424d4..2572e5083 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -4,6 +4,7 @@
#include "../common/cbasetypes.h"
#include "../common/malloc.h"
#include "../common/nullpo.h"
+#include "../common/showmsg.h"
#include "../common/strlib.h"
#include "atcommand.h" // msg_txt()
#include "battle.h" // struct battle_config
@@ -293,6 +294,12 @@ int chat_createnpcchat(struct npc_data* nd, const char* title, int limit, bool p
struct chat_data* cd;
nullpo_retr(0, nd);
+ if( nd->chat_id )
+ {
+ ShowError("chat_createnpcchat: npc '%s' already has a chatroom, cannot create new one!\n", nd->exname);
+ return 0;
+ }
+
cd = chat_createchat(&nd->bl, title, "", limit, pub, trigger, ev);
if( cd )
{