subs: Oops on makelost() / makenotlost() with no owner

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>
This commit is contained in:
Markus Armbruster 2016-06-04 17:38:25 +02:00
parent 41d0a79118
commit a6a2e0b5da

View 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;