mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-01 13:40:59 +00:00
Save and restore the OGG state only of the backend is enabled.
Otherwise we might end up in situations were `OGG_SaveState()` writes invalid values into the state struct and `OGG_ResumeState()` tries to recover theses values into an uninitialized stb_vorbis state. This may lead to NULL pointers in stb_vorbis and other problems. Closes #1135.
This commit is contained in:
parent
7c88889716
commit
da15696d23
1 changed files with 2 additions and 3 deletions
|
@ -774,10 +774,9 @@ OGG_Cmd(void)
|
|||
void
|
||||
OGG_SaveState(void)
|
||||
{
|
||||
if (ogg_status != PLAY)
|
||||
if (ogg_enabled->value != 1 || ogg_status != PLAY)
|
||||
{
|
||||
ogg_saved_state.saved = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -792,7 +791,7 @@ OGG_SaveState(void)
|
|||
void
|
||||
OGG_RecoverState(void)
|
||||
{
|
||||
if (!ogg_saved_state.saved)
|
||||
if (ogg_enabled->value != 1 || ogg_saved_state.saved != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue