summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-12 09:59:46 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-06-12 09:59:46 +0000
commit1a7d8ba302f9953c5995a84db8eed17d3683aa87 (patch)
treee31e733904735eacf2ad8f1601cfd836124e16cd
parent5edaf054f8cfac09b95583cbe4d5c64df850b82b (diff)
downloadhercules-1a7d8ba302f9953c5995a84db8eed17d3683aa87.tar.gz
hercules-1a7d8ba302f9953c5995a84db8eed17d3683aa87.tar.bz2
hercules-1a7d8ba302f9953c5995a84db8eed17d3683aa87.tar.xz
hercules-1a7d8ba302f9953c5995a84db8eed17d3683aa87.zip
Added check to prevent crashing on logmes with no player attached (bugreport:1648).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12815 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/script.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 089ec7f3e..fd4289264 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2008/06/12
+ * Added check to prevent crashing on logmes with no player attached
+ (bugreport:1648) [ultramage]
* Added support for skill names to script commands: [FlavioJS]
- skill, addtoskill, guildskill, getskilllv, getgdskilllv, itemskill,
petskillattack, petskillattack2, petskillsupport, skilleffect,
diff --git a/src/map/script.c b/src/map/script.c
index 50e64b8e9..b1f6371ec 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -11282,9 +11282,17 @@ BUILDIN_FUNC(getmapxy)
BUILDIN_FUNC(logmes)
{
const char *str;
- if (log_config.npc <= 0 ) return 0;
+ TBL_PC* sd;
+
+ if( log_config.npc <= 0 )
+ return 0;
+
+ sd = script_rid2sd(st);
+ if( sd == NULL )
+ return 1;
+
str = script_getstr(st,2);
- log_npc(script_rid2sd(st),str);
+ log_npc(sd,str);
return 0;
}