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:
Yamagi 2024-09-08 16:34:04 +02:00
parent 7c88889716
commit da15696d23

View file

@ -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;
}