tDon't crash if the sound file doesn't exist - vaccinewars - be a doctor and try to vaccinate the world
(HTM) git clone git://src.adamsgaard.dk/vaccinewars
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ff75c12c4ffe68e12f48110b05dcb6537ab923eb
(DIR) parent d01de5ab48d16a145dd0e34df1148b0230a51489
(HTM) Author: Ben Webb <ben@salilab.org>
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(-)
---
(DIR) 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 */