qbsp: make ValueForKey return empty string if key not found
Less error prone as it's usually followed by a strn?cmp or something. Callers that were relying on null checks updated. Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
parent
746a210f2a
commit
54acacb2c2
|
|
@ -310,7 +310,7 @@ FindTargetEntity(const char *target)
|
|||
|
||||
for (i = 0, ent = map.entities; i < map.numentities; i++, ent++) {
|
||||
name = ValueForKey(ent, "targetname");
|
||||
if (name && !strcasecmp(target, name))
|
||||
if (!strcasecmp(target, name))
|
||||
return ent;
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ FixRotateOrigin(mapentity_t *ent)
|
|||
char value[20];
|
||||
|
||||
search = ValueForKey(ent, "target");
|
||||
if (search)
|
||||
if (search[0])
|
||||
target = FindTargetEntity(search);
|
||||
|
||||
if (target) {
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ ValueForKey(const mapentity_t *ent, const char *key)
|
|||
if (!strcmp(ep->key, key))
|
||||
return ep->value;
|
||||
|
||||
return NULL;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -236,15 +236,15 @@ ProcessFile(void)
|
|||
}
|
||||
|
||||
wadstring = ValueForKey(pWorldEnt, "_wad");
|
||||
if (!wadstring)
|
||||
if (!wadstring[0])
|
||||
wadstring = ValueForKey(pWorldEnt, "wad");
|
||||
if (!wadstring)
|
||||
if (!wadstring[0])
|
||||
Message(msgWarning, warnNoWadKey);
|
||||
else
|
||||
numwads = WADList_Init(&wads, wadstring);
|
||||
|
||||
if (!numwads) {
|
||||
if (wadstring)
|
||||
if (wadstring[0])
|
||||
Message(msgWarning, warnNoValidWads);
|
||||
/* Try the default wad name */
|
||||
defaultwad = AllocMem(OTHER, strlen(options.szMapName) + 5, false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue