mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Fix crash when surfaces fail to allocate
This commit is contained in:
parent
e16f3eb075
commit
a35d759a46
2 changed files with 3 additions and 0 deletions
|
|
@ -71,6 +71,7 @@ static struct Surface *alloc_surface(void) {
|
||||||
// we, um...
|
// we, um...
|
||||||
// Perhaps originally just debug feedback?
|
// Perhaps originally just debug feedback?
|
||||||
if (gSurfacesAllocated >= sSurfacePoolSize) {
|
if (gSurfacesAllocated >= sSurfacePoolSize) {
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface->type = 0;
|
surface->type = 0;
|
||||||
|
|
@ -363,6 +364,7 @@ static struct Surface *read_surface_data(s16 *vertexData, s16 **vertexIndices) {
|
||||||
nz *= mag;
|
nz *= mag;
|
||||||
|
|
||||||
surface = alloc_surface();
|
surface = alloc_surface();
|
||||||
|
if (surface == NULL) { return NULL; }
|
||||||
|
|
||||||
vec3s_copy(surface->prevVertex1, surface->vertex1);
|
vec3s_copy(surface->prevVertex1, surface->vertex1);
|
||||||
vec3s_copy(surface->prevVertex2, surface->vertex2);
|
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);
|
struct Object* obj = spawn_object(gMarioStates[0].marioObj, loadedModelId, behavior);
|
||||||
|
|
||||||
if (obj == NULL) {
|
if (obj == NULL) {
|
||||||
LOG_ERROR("failed to allocate object");
|
LOG_ERROR("failed to allocate object");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue