summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-07 23:13:04 +0000
committercookiecrumbs <cookiecrumbs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-11-07 23:13:04 +0000
commit2b86d531215226674273cc168863961d293aea21 (patch)
treec787789499780cb4549459bcf435dfefa080b9bb /src
parent2426a5bf2f8b340763b515c1ef39afeeb57789ae (diff)
downloadhercules-2b86d531215226674273cc168863961d293aea21.tar.gz
hercules-2b86d531215226674273cc168863961d293aea21.tar.bz2
hercules-2b86d531215226674273cc168863961d293aea21.tar.xz
hercules-2b86d531215226674273cc168863961d293aea21.zip
Fixed various quest-related script commands - including: setquest, erasequest, completequest, checkquest - to fix crashes caused of null pointers (sd).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16866 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 89812b40b..1045f1c94 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -15682,7 +15682,8 @@ Questlog script commands
BUILDIN_FUNC(setquest)
{
- TBL_PC * sd = script_rid2sd(st);
+ struct map_session_data *sd = script_rid2sd(st);
+ nullpo_ret(sd);
quest_add(sd, script_getnum(st, 2));
return 0;
@@ -15690,7 +15691,8 @@ BUILDIN_FUNC(setquest)
BUILDIN_FUNC(erasequest)
{
- TBL_PC * sd = script_rid2sd(st);
+ struct map_session_data *sd = script_rid2sd(st);
+ nullpo_ret(sd);
quest_delete(sd, script_getnum(st, 2));
return 0;
@@ -15698,7 +15700,8 @@ BUILDIN_FUNC(erasequest)
BUILDIN_FUNC(completequest)
{
- TBL_PC * sd = script_rid2sd(st);
+ struct map_session_data *sd = script_rid2sd(st);
+ nullpo_ret(sd);
quest_update_status(sd, script_getnum(st, 2), Q_COMPLETE);
return 0;
@@ -15706,7 +15709,8 @@ BUILDIN_FUNC(completequest)
BUILDIN_FUNC(changequest)
{
- TBL_PC * sd = script_rid2sd(st);
+ struct map_session_data *sd = script_rid2sd(st);
+ nullpo_ret(sd);
quest_change(sd, script_getnum(st, 2),script_getnum(st, 3));
return 0;
@@ -15714,9 +15718,11 @@ BUILDIN_FUNC(changequest)
BUILDIN_FUNC(checkquest)
{
- TBL_PC * sd = script_rid2sd(st);
+ struct map_session_data *sd = script_rid2sd(st);
quest_check_type type = HAVEQUEST;
+ nullpo_ret(sd);
+
if( script_hasdata(st, 3) )
type = (quest_check_type)script_getnum(st, 3);