Skip digi_sync_sounds loop if !Viewer

If a sound is used, it may dereference Viewer.  If Viewer is null, this
will crash.  In 630f11945e,
digi_sync_sounds changed to assume Viewer is valid.  This crashes during
early startup when not using the SDL_mixer backend, even though no
sounds are in use.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/45>
Fixes: 630f11945e ("Cache Viewer in digiobj")
This commit is contained in:
Kp 2015-03-15 18:52:52 +00:00
parent ac39b6cb40
commit 2458078987

View file

@ -530,6 +530,8 @@ void digi_sync_sounds()
}
SoundQ_process();
if (!Viewer)
return;
const vcobjptr_t viewer{Viewer};
range_for (auto &s, SoundObjects)
{