shithub: cstory

Download patch

ref: 93cf72e2693b430442d19eb806b388b8495e7392
parent: 4f80ff4139a5a0b48e2290e425e126f2c29301cf
author: Clownacy <Clownacy@users.noreply.github.com>
date: Sun Apr 19 15:45:09 EDT 2020

Add sanity checks to the Wii U hardware mixer

The other audio backends have these - probably for a good reason,
too.

--- a/src/Backends/Audio/WiiU.cpp
+++ b/src/Backends/Audio/WiiU.cpp
@@ -199,6 +199,9 @@
 
 void AudioBackend_DestroySound(AudioBackend_Sound *sound)
 {
+	if (sound == NULL)
+		return;
+
 	OSLockMutex(&sound_list_mutex);
 
 	// Unhook sound from the linked-list
@@ -226,6 +229,9 @@
 
 void AudioBackend_PlaySound(AudioBackend_Sound *sound, bool looping)
 {
+	if (sound == NULL)
+		return;
+
 	CullVoices();
 
 	OSLockMutex(&sound_list_mutex);
@@ -285,6 +291,9 @@
 
 void AudioBackend_StopSound(AudioBackend_Sound *sound)
 {
+	if (sound == NULL)
+		return;
+
 	OSLockMutex(&sound_list_mutex);
 
 	if (sound->voice != NULL)
@@ -301,6 +310,9 @@
 
 void AudioBackend_RewindSound(AudioBackend_Sound *sound)
 {
+	if (sound == NULL)
+		return;
+
 	OSLockMutex(&sound_list_mutex);
 
 	if (sound->voice != NULL)
@@ -317,6 +329,9 @@
 
 void AudioBackend_SetSoundFrequency(AudioBackend_Sound *sound, unsigned int frequency)
 {
+	if (sound == NULL)
+		return;
+
 	OSLockMutex(&sound_list_mutex);
 
 	sound->frequency = frequency;
@@ -336,6 +351,9 @@
 
 void AudioBackend_SetSoundVolume(AudioBackend_Sound *sound, long volume)
 {
+	if (sound == NULL)
+		return;
+
 	OSLockMutex(&sound_list_mutex);
 
 	sound->volume = (unsigned short)(0x8000 * MillibelToScale(volume));
@@ -356,6 +374,9 @@
 
 void AudioBackend_SetSoundPan(AudioBackend_Sound *sound, long pan)
 {
+	if (sound == NULL)
+		return;
+
 	OSLockMutex(&sound_list_mutex);
 
 	sound->pan_l = (unsigned short)(0x8000 * MillibelToScale(-pan));