From e68b3f6694c281306dce94a7f95e2acb016538c6 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 11 Jan 2019 12:55:51 +0200 Subject: [PATCH] - fixed crash when playing sounds with no level loaded --- src/s_sound.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 4104809e20..7e0c23a724 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -991,15 +991,18 @@ static FSoundChan *S_StartSound(FLevelLocals *Level, AActor *actor, const sector return nullptr; } - if (Level->i_compatflags & COMPATF_MAGICSILENCE) - { // For people who just can't play without a silent BFG. - channel = CHAN_WEAPON; - } - else if ((chanflags & CHAN_MAYBE_LOCAL) && (Level->i_compatflags & COMPATF_SILENTPICKUP)) + if (Level != nullptr) { - if (actor != NULL && actor != players[consoleplayer].camera) + if (Level->i_compatflags & COMPATF_MAGICSILENCE) + { // For people who just can't play without a silent BFG. + channel = CHAN_WEAPON; + } + else if ((chanflags & CHAN_MAYBE_LOCAL) && (Level->i_compatflags & COMPATF_SILENTPICKUP)) { - return NULL; + if (actor != nullptr && actor != players[consoleplayer].camera) + { + return nullptr; + } } }