static analyzer bit display.c

A static analyzer pointed out that the 'if' was checking
for null pointer, but the 'else' was not, yet they were
both then dereferencing the same variable.
This commit is contained in:
nhmall
2023-01-02 16:06:11 -05:00
parent dc6ad9266b
commit 33c13d6fff

View File

@@ -2275,12 +2275,18 @@ get_bkglyph_and_framecolor(coordxy x, coordxy y, int *bkglyph, uint32 *framecolo
if (idx != S_room)
tmp_bkglyph = cmap_to_glyph(idx);
}
if (gw.wsettings.map_frame_color != NO_COLOR && framecolor && mapxy_valid(x, y))
*bkglyph = tmp_bkglyph;
#if 0
/* this guard should be unnecessary */
if (!framecolor) {
impossible("null framecolor passed to get_bkglyph_and_framecolor");
return;
}
#endif
if (gw.wsettings.map_frame_color != NO_COLOR && mapxy_valid(x, y))
*framecolor = gw.wsettings.map_frame_color;
else
*framecolor = NO_COLOR;
*bkglyph = tmp_bkglyph;
}
#if defined(TILES_IN_GLYPHMAP) && defined(MSDOS)