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:
parent
41d0a79118
commit
a6a2e0b5da
1 changed files with 5 additions and 1 deletions
|
@ -28,7 +28,7 @@
|
||||||
*
|
*
|
||||||
* Known contributors to this file:
|
* Known contributors to this file:
|
||||||
* Steve McClure, 1997
|
* Steve McClure, 1997
|
||||||
* Markus Armbruster, 2008
|
* Markus Armbruster, 2008-2016
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
@ -60,6 +60,8 @@ makelost(int type, natid owner, int id, coord x, coord y)
|
||||||
struct loststr lost;
|
struct loststr lost;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
if (CANT_HAPPEN(!owner))
|
||||||
|
return;
|
||||||
n = findlost(type, owner, id, x, y, 1);
|
n = findlost(type, owner, id, x, y, 1);
|
||||||
ef_blank(EF_LOST, n, &lost);
|
ef_blank(EF_LOST, n, &lost);
|
||||||
lost.lost_type = type;
|
lost.lost_type = type;
|
||||||
|
@ -76,6 +78,8 @@ makenotlost(int type, natid owner, int id, coord x, coord y)
|
||||||
struct loststr lost;
|
struct loststr lost;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
|
if (CANT_HAPPEN(!owner))
|
||||||
|
return;
|
||||||
n = findlost(type, owner, id, x, y, 0);
|
n = findlost(type, owner, id, x, y, 0);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue