tDon't crash if the sound file doesn't exist - vaccinewars - be a doctor and tr… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ff75c12c4ffe68e12f48110b05dcb6537ab923eb | |
parent d01de5ab48d16a145dd0e34df1148b0230a51489 | |
Author: Ben Webb <[email protected]> | |
Date: Sat, 21 Nov 2020 01:30:16 -0800 | |
Don't crash if the sound file doesn't exist | |
Diffstat: | |
M src/plugins/sound_cocoa.m | 2 ++ | |
1 file changed, 2 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/src/plugins/sound_cocoa.m b/src/plugins/sound_cocoa.m | |
t@@ -52,6 +52,8 @@ static void SoundPlay_Cocoa(const gchar *snd) | |
p = [play_by_name objectForKey:sound]; | |
if (!p) { | |
p = [[NSSound alloc] initWithContentsOfFile:sound byReference:YES]; | |
+ /* If the sound file doesn't exist, do nothing */ | |
+ if (!p) return; | |
[play_by_name setObject:p forKey:sound]; | |
} | |
/* First, stop any currently playing sound */ |