From d9b231e2aaed771a1923867d0e4122f81a8d7ae8 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 10 Nov 2022 14:44:08 +0900 Subject: [PATCH] [util] Return null for missing wad lumps Segfaults are not good when a lump can't be found as it makes error checking difficult. --- libs/util/wad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/util/wad.c b/libs/util/wad.c index 017e48605..1fbb91b39 100644 --- a/libs/util/wad.c +++ b/libs/util/wad.c @@ -132,7 +132,7 @@ W_GetLumpName (const char *name) } lump = W_GetLumpinfo (name); - return (void *) (wad_base + lump->filepos); + return lump ? (wad_base + lump->filepos) : 0; } VISIBLE void