Fix segfault on device without available sound cards

In such case sound system left uninitialized and without cvars.
----
Thread 1 "quake2" received signal SIGSEGV, Segmentation fault.
0x00005555555956a1 in OGG_PlayTrack (trackNo=7) at src/client/sound/ogg.c:351
351 if((trackNo == 0) || ogg_shuffle->value)
(gdb) bt
#0  0x00005555555956a1 in OGG_PlayTrack (trackNo=7) at
src/client/sound/ogg.c:351
#1  0x000055555557bded in CL_PrepRefresh () at src/client/cl_view.c:367
#2  0x000055555556e1a0 in CL_Precache_f () at src/client/cl_main.c:472
#3  0x00005555555a40dc in Cbuf_Execute () at src/common/cmdparser.c:229
#4  0x000055555556f0f9 in CL_Frame (packetdelta=<optimized out>,
renderdelta=<optimized out>, timedelta=<optimized out>,
packetframe=packetframe@entry=true,
    renderframe=renderframe@entry=false) at src/client/cl_main.c:803
#5  0x00005555555aa0c5 in Qcommon_Frame (usec=5) at src/common/frame.c:626
#6  0x00005555555aa48e in Qcommon_Mainloop () at src/common/frame.c:163
#7  0x00005555555aaae6 in Qcommon_Init (argc=1, argv=0x7fffffffdfa8)
at src/common/frame.c:377
#8  0x000055555555e564 in main (argc=1, argv=0x7fffffffdfa8) at
src/backends/unix/main.c:123
----
This commit is contained in:
Denis Pauk 2020-01-30 22:45:01 +02:00
parent dec8125e07
commit 6e80924050

View file

@ -324,6 +324,11 @@ OGG_Stream(void)
void
OGG_PlayTrack(int trackNo)
{
if (sound_started == SS_NOT)
{
return; // sound is not initialized
}
// Track 0 means "stop music".
if(trackNo == 0)
{