Browse Source

UI: Fix crash when no audio backends are available

This commit prevents a crash in, for example, Linux configurations
where PulseAudio is disabled, which leads into 'mod' being 'null',
which in turn leads into a segmentation fault when an ALSA source
is selected.

Closes https://github.com/obsproject/obs-studio/issues/3485
Jimi Huotari 4 years ago
parent
commit
41367bb2b4
1 changed files with 4 additions and 0 deletions
  1. 4 0
      UI/context-bar-controls.cpp

+ 4 - 0
UI/context-bar-controls.cpp

@@ -179,6 +179,10 @@ void AudioCaptureToolbar::Init()
 
 	obs_module_t *mod =
 		get_os_module("win-wasapi", "mac-capture", "linux-pulseaudio");
+	if (!mod) {
+		return;
+	}
+
 	const char *device_str =
 		get_os_text(mod, "Device", "CoreAudio.Device", "Device");
 	ui->deviceLabel->setText(device_str);