mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
fix(sound): correct potential use-after-scope in SI2::PlaySoundKit
This commit is contained in:
parent
8e06d02632
commit
0d4afee947
@ -369,6 +369,13 @@ int32_t SI2::PlaySoundKit(int32_t id, int32_t a2, SOUNDKITOBJECT* object, SoundK
|
|||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get sound pointer
|
||||||
|
|
||||||
|
// Stack-allocated SESound is used as placeholder if no sound was provided by object. This
|
||||||
|
// needs to be declared here, at function scope, to avoid potential use-after-scope behavior
|
||||||
|
// in CompleteLoad() and Play() below.
|
||||||
|
SESound newSound = {};
|
||||||
|
|
||||||
SESound* sound;
|
SESound* sound;
|
||||||
|
|
||||||
if (object) {
|
if (object) {
|
||||||
@ -376,7 +383,6 @@ int32_t SI2::PlaySoundKit(int32_t id, int32_t a2, SOUNDKITOBJECT* object, SoundK
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
} else {
|
} else {
|
||||||
SESound newSound = {};
|
|
||||||
sound = &newSound;
|
sound = &newSound;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user