Fix crash when surfaces fail to allocate
This commit is contained in:
parent
e16f3eb075
commit
a35d759a46
|
@ -71,6 +71,7 @@ static struct Surface *alloc_surface(void) {
|
|||
// we, um...
|
||||
// Perhaps originally just debug feedback?
|
||||
if (gSurfacesAllocated >= sSurfacePoolSize) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
surface->type = 0;
|
||||
|
@ -363,6 +364,7 @@ static struct Surface *read_surface_data(s16 *vertexData, s16 **vertexIndices) {
|
|||
nz *= mag;
|
||||
|
||||
surface = alloc_surface();
|
||||
if (surface == NULL) { return NULL; }
|
||||
|
||||
vec3s_copy(surface->prevVertex1, surface->vertex1);
|
||||
vec3s_copy(surface->prevVertex2, surface->vertex2);
|
||||
|
|
|
@ -22,6 +22,7 @@ static struct Object* spawn_object_internal(enum BehaviorId behaviorId, enum Mod
|
|||
}
|
||||
|
||||
struct Object* obj = spawn_object(gMarioStates[0].marioObj, loadedModelId, behavior);
|
||||
|
||||
if (obj == NULL) {
|
||||
LOG_ERROR("failed to allocate object");
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue