Skip to content

Commit d9831f6

Browse files
committed
AR bugfix
prevents crash in case that audioSource creation (audio startup) failed
1 parent 8ac5b44 commit d9831f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

usermods/audioreactive/audio_reactive.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ class AudioReactive : public Usermod {
13211321
disableSoundProcessing = true;
13221322
} else {
13231323
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DEBUG)
1324-
if ((disableSoundProcessing == true) && (audioSyncEnabled == 0) && audioSource->isInitialized()) { // we just switched to "enabled"
1324+
if ((disableSoundProcessing == true) && (audioSyncEnabled == 0) && audioSource && audioSource->isInitialized()) { // we just switched to "enabled"
13251325
DEBUG_PRINTLN(F("[AR userLoop] realtime mode ended - audio processing resumed."));
13261326
DEBUG_PRINTF_P(PSTR(" RealtimeMode = %d; RealtimeOverride = %d\n"), int(realtimeMode), int(realtimeOverride));
13271327
}
@@ -1333,7 +1333,7 @@ class AudioReactive : public Usermod {
13331333
if (audioSyncEnabled & 0x02) disableSoundProcessing = true; // make sure everything is disabled IF in audio Receive mode
13341334
if (audioSyncEnabled & 0x01) disableSoundProcessing = false; // keep running audio IF we're in audio Transmit mode
13351335
#ifdef ARDUINO_ARCH_ESP32
1336-
if (!audioSource->isInitialized()) disableSoundProcessing = true; // no audio source
1336+
if (!audioSource || !audioSource->isInitialized()) disableSoundProcessing = true; // no audio source
13371337

13381338

13391339
// Only run the sampling code IF we're not in Receive mode or realtime mode

0 commit comments

Comments
 (0)