Fixed crash in find_floor_from_list()

This commit is contained in:
MysterD 2022-03-21 12:29:30 -07:00
parent 5c02a45c70
commit 5dc8c645c4
1 changed files with 5 additions and 1 deletions

View File

@ -425,6 +425,7 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
// Iterate through the list of floors until there are no more floors.
while (surfaceNode != NULL) {
surf = surfaceNode->surface;
if (surf == NULL) { break; }
surfaceNode = surfaceNode->next;
interpolate = gInterpolatingSurfaces && surf->modifiedTimestamp == gGlobalTimer;
@ -521,7 +522,10 @@ static struct Surface *find_floor_from_list(struct SurfaceNode *surfaceNode, s32
continue;
}
*pheight = height;
if (pheight != NULL) {
*pheight = height;
}
if (interpolate) {
static struct Surface s;
s.type = surf->type;