mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 05:25:14 +00:00
Fix crash in spawn_star_number()
This commit is contained in:
parent
1b8baecaf9
commit
8bc8f59883
1 changed files with 3 additions and 1 deletions
|
@ -28,7 +28,7 @@ void spawn_star_number(void) {
|
||||||
// Check if the star already has a number
|
// Check if the star already has a number
|
||||||
struct Object *starNumber = obj_get_first_with_behavior_id(id_bhvStarNumber);
|
struct Object *starNumber = obj_get_first_with_behavior_id(id_bhvStarNumber);
|
||||||
for (; starNumber; starNumber = obj_get_next_with_same_behavior_id(starNumber)) {
|
for (; starNumber; starNumber = obj_get_next_with_same_behavior_id(starNumber)) {
|
||||||
if (starNumber->parentObj == o) {
|
if (!starNumber || starNumber->parentObj == o) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,8 @@ void spawn_star_number(void) {
|
||||||
// If not, spawn a number
|
// If not, spawn a number
|
||||||
if (!starNumber) {
|
if (!starNumber) {
|
||||||
starNumber = spawn_object(o, MODEL_NUMBER, bhvStarNumber);
|
starNumber = spawn_object(o, MODEL_NUMBER, bhvStarNumber);
|
||||||
|
}
|
||||||
|
if (starNumber) {
|
||||||
starNumber->parentObj = o;
|
starNumber->parentObj = o;
|
||||||
starNumber->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP; // to make sure it's updated even during time stop
|
starNumber->activeFlags |= ACTIVE_FLAG_INITIATED_TIME_STOP; // to make sure it's updated even during time stop
|
||||||
starNumber->oStarBehavior = (const void *) smlua_override_behavior(o->behavior);
|
starNumber->oStarBehavior = (const void *) smlua_override_behavior(o->behavior);
|
||||||
|
|
Loading…
Reference in a new issue