mirror of
https://github.com/libsm64/libsm64.git
synced 2025-01-22 15:43:11 -05:00
#3 - Fix null ptr deref when deleting platform while Mario pool is sparse
This commit is contained in:
parent
c818f9cf51
commit
82e53bef23
1 changed files with 3 additions and 0 deletions
|
@ -241,6 +241,9 @@ SM64_LIB_FN void sm64_surface_object_delete( uint32_t objectId )
|
|||
// A mario standing on the platform that is being destroyed will have a pointer to freed memory if we don't clear it.
|
||||
for( int i = 0; i < s_mario_instance_pool.size; ++i )
|
||||
{
|
||||
if( s_mario_instance_pool.objects[i] == NULL )
|
||||
continue;
|
||||
|
||||
struct GlobalState *state = ((struct MarioInstance *)s_mario_instance_pool.objects[ i ])->globalState;
|
||||
if( state->mgMarioObject->platform == surfaces_object_get_transform_ptr( objectId ))
|
||||
state->mgMarioObject->platform = NULL;
|
||||
|
|
Loading…
Reference in a new issue