From 4b12afced9c20a9314a630a3e46b103b204ae58f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 26 Oct 2020 11:31:17 +0200 Subject: [PATCH] screencast: Handle the case where pipewire is not installed If pipewire is not installed, pw_loop_new() may return a nullptr. BUG: 427949 --- screencast/pipewirecore.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/screencast/pipewirecore.cpp b/screencast/pipewirecore.cpp index 32b480e54d..8742c814d2 100644 --- a/screencast/pipewirecore.cpp +++ b/screencast/pipewirecore.cpp @@ -56,6 +56,11 @@ void PipeWireCore::onCoreError(void* data, uint32_t id, int seq, int res, const bool PipeWireCore::init() { pwMainLoop = pw_loop_new(nullptr); + if (!pwMainLoop) { + qCWarning(KWIN_SCREENCAST, "Failed to create PipeWire loop: %s", strerror(errno)); + m_error = i18n("Failed to start main PipeWire loop"); + return false; + } pw_loop_enter(pwMainLoop); QSocketNotifier *notifier = new QSocketNotifier(pw_loop_get_fd(pwMainLoop), QSocketNotifier::Read, this);