From c370dd831312dc957d46e76ccd8f976888a6f7d2 Mon Sep 17 00:00:00 2001
From: trilene <trilene@runbox.com>
Date: Thu, 29 Oct 2020 18:57:09 -0400
Subject: [PATCH] Avoid ugly error if pipeline creation fails

---
 src/WebRTCSession.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/WebRTCSession.cpp b/src/WebRTCSession.cpp
index 40a9753e1..d4e68b04e 100644
--- a/src/WebRTCSession.cpp
+++ b/src/WebRTCSession.cpp
@@ -1106,8 +1106,10 @@ WebRTCSession::end()
                 gst_element_set_state(pipe_, GST_STATE_NULL);
                 gst_object_unref(pipe_);
                 pipe_ = nullptr;
-                g_source_remove(busWatchId_);
-                busWatchId_ = 0;
+                if (busWatchId_) {
+                        g_source_remove(busWatchId_);
+                        busWatchId_ = 0;
+                }
         }
         webrtc_                = nullptr;
         isVideo_               = false;
-- 
GitLab