diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-07-17 04:15:04 -0400 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2023-07-17 04:15:04 -0400 |
commit | 857e94af3817932b78963873fb5621ae3c4596f7 (patch) | |
tree | 96777ba10d06016d82959776f37d12f0105f48d9 /src/windows | |
parent | 49bbc926e76147d2f380685d4635ebcdf2163f8f (diff) | |
download | abaddon-portaudio-857e94af3817932b78963873fb5621ae3c4596f7.tar.gz abaddon-portaudio-857e94af3817932b78963873fb5621ae3c4596f7.zip |
dont error if no capture or playback devices are available to try initializing (#193)
Diffstat (limited to 'src/windows')
-rw-r--r-- | src/windows/voicewindow.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/windows/voicewindow.cpp b/src/windows/voicewindow.cpp index a4677c6..829a1b8 100644 --- a/src/windows/voicewindow.cpp +++ b/src/windows/voicewindow.cpp @@ -139,7 +139,9 @@ VoiceWindow::VoiceWindow(Snowflake channel_id) m_playback_combo.set_hexpand(true); m_playback_combo.set_halign(Gtk::ALIGN_FILL); m_playback_combo.set_model(Abaddon::Get().GetAudio().GetDevices().GetPlaybackDeviceModel()); - m_playback_combo.set_active(Abaddon::Get().GetAudio().GetDevices().GetActivePlaybackDevice()); + if (const auto iter = Abaddon::Get().GetAudio().GetDevices().GetActivePlaybackDevice()) { + m_playback_combo.set_active(iter); + } m_playback_combo.pack_start(*playback_renderer); m_playback_combo.add_attribute(*playback_renderer, "text", 0); m_playback_combo.signal_changed().connect([this]() { @@ -151,7 +153,9 @@ VoiceWindow::VoiceWindow(Snowflake channel_id) m_capture_combo.set_hexpand(true); m_capture_combo.set_halign(Gtk::ALIGN_FILL); m_capture_combo.set_model(Abaddon::Get().GetAudio().GetDevices().GetCaptureDeviceModel()); - m_capture_combo.set_active(Abaddon::Get().GetAudio().GetDevices().GetActiveCaptureDevice()); + if (const auto iter = Abaddon::Get().GetAudio().GetDevices().GetActiveCaptureDevice()) { + m_capture_combo.set_active(iter); + } m_capture_combo.pack_start(*capture_renderer); m_capture_combo.add_attribute(*capture_renderer, "text", 0); m_capture_combo.signal_changed().connect([this]() { |