X-Git-Url: https://plomlompom.com/repos/index.html?a=blobdiff_plain;ds=sidebyside;f=src%2Fmap_objects.c;h=d220556907d29c0576531a6fd964d078e5d04693;hb=1872b8ed64328ebafec56b0888fa48f60fb4942b;hp=28d9b146864e70ece8f99ebd3c0c81255c3ed1b6;hpb=3f85df09f025ef8ab3f655cf5e4517b3be66f0ee;p=plomrogue
diff --git a/src/map_objects.c b/src/map_objects.c
index 28d9b14..d220556 100644
--- a/src/map_objects.c
+++ b/src/map_objects.c
@@ -308,10 +308,11 @@ extern void * build_map_objects(struct World * world, void * start, char def_id,
extern void free_items(struct Item * item)
{
- if (0 != item->map_obj.next)
+ if (0 == item)
{
- free_items((struct Item *) item->map_obj.next);
+ return;
}
+ free_items((struct Item *) item->map_obj.next);
free(item);
}
@@ -319,10 +320,11 @@ extern void free_items(struct Item * item)
extern void free_monsters(struct Monster * monster)
{
- if (0 != monster->map_obj.next)
+ if (0 == monster)
{
- free_monsters((struct Monster *) monster->map_obj.next);
+ return;
}
+ free_monsters((struct Monster *) monster->map_obj.next);
free(monster);
}