]> git.pond.sub.org Git - empserver/commitdiff
subs: Oops on makelost() / makenotlost() with no owner
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 4 Jun 2016 15:38:25 +0000 (17:38 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 17:59:57 +0000 (19:59 +0200)
This catches bogus entries in the "lost" file like the ones fixed in
the previous commit.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/lostsub.c

index ad423c25b238153fb797a5be45e8f83876d0262a..b250543830e36b34be73406e7c59e073ef4a6c95 100644 (file)
@@ -28,7 +28,7 @@
  *
  *  Known contributors to this file:
  *     Steve McClure, 1997
- *     Markus Armbruster, 2008
+ *     Markus Armbruster, 2008-2016
  */
 
 #include <config.h>
@@ -60,6 +60,8 @@ makelost(int type, natid owner, int id, coord x, coord y)
     struct loststr lost;
     int n;
 
+    if (CANT_HAPPEN(!owner))
+       return;
     n = findlost(type, owner, id, x, y, 1);
     ef_blank(EF_LOST, n, &lost);
     lost.lost_type = type;
@@ -76,6 +78,8 @@ makenotlost(int type, natid owner, int id, coord x, coord y)
     struct loststr lost;
     int n;
 
+    if (CANT_HAPPEN(!owner))
+       return;
     n = findlost(type, owner, id, x, y, 0);
     if (n < 0)
        return;