|
From: Crossfire C. r. messages.
<cro...@li...> - 2020-11-19 15:15:07
|
Revision: 21551
http://sourceforge.net/p/crossfire/code/21551
Author: ryo_saeba
Date: 2020-11-19 15:15:01 +0000 (Thu, 19 Nov 2020)
Log Message:
-----------
Tentatively fix crash in plugin when weird stuff was done to our poor NPC.
Modified Paths:
--------------
server/trunk/plugins/citylife/citylife.c
Modified: server/trunk/plugins/citylife/citylife.c
===================================================================
--- server/trunk/plugins/citylife/citylife.c 2020-11-18 20:12:18 UTC (rev 21550)
+++ server/trunk/plugins/citylife/citylife.c 2020-11-19 15:15:01 UTC (rev 21551)
@@ -771,7 +771,7 @@
int rv = 1;
va_list args;
/*char *buf;*/
- object *ground, *who/*, *activator, *third, *event*/;
+ object *ground, *who/*, *activator, *third*/, *event;
/*int fix;*/
const char *value;
@@ -782,12 +782,24 @@
/*third =*/ va_arg(args, object *);
/*buf =*/ va_arg(args, char *);
/*fix =*/ va_arg(args, int);
- /*event =*/ va_arg(args, object *);
+ event = va_arg(args, object *);
va_arg(args, talk_info *); /* ignored for now */
va_end(args);
object *inv;
value = cf_object_get_key(who, FIRST_MOVE_KEY);
+ if (!value) {
+ /**
+ * If the key doesn't exist, it means 'who' wasn't created by us,
+ * since we do set the key each time.
+ * So play it safe and totally remove the event.
+ */
+ if (event) {
+ cf_log(llevInfo, "citylife: removing event from object which we didn't generate\n");
+ cf_object_remove(event);
+ }
+ return rv;
+ }
// Set the flag regardless of whether we tried to move through an exit
if (strcmp(value, "1") == 0) {
cf_object_set_key(who, FIRST_MOVE_KEY, "0", 1);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|