From 53ef77b49c8b17f8c11f67e701278a30a2c28bfb Mon Sep 17 00:00:00 2001 From: Moritz Brunner <moritzbrunner@freenet.de> Date: Tue, 30 Jul 2019 18:08:53 +0200 Subject: [PATCH] ringmainwindow: prevent segmentation fault Prevent a segmentation fault in function slotNewConversation Gitlab: #1054 Change-Id: Iff82c5745b488a65663330f226a631773ba06c67 Reviewed-by: Philippe Gorley <philippe.gorley@savoirfairelinux.com> --- src/ringmainwindow.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ringmainwindow.cpp b/src/ringmainwindow.cpp index 1ed2da55..3d9d7c2f 100644 --- a/src/ringmainwindow.cpp +++ b/src/ringmainwindow.cpp @@ -2175,11 +2175,13 @@ CppImpl::slotNewConversation(const std::string& uid) auto* old_view = gtk_bin_get_child(GTK_BIN(widgets->frame_call)); if (IS_RING_WELCOME_VIEW(old_view)) { accountInfo_->conversationModel->selectConversation(uid); - try { - auto contactUri = chatViewConversation_->participants.front(); - auto contactInfo = accountInfo_->contactModel->getContact(contactUri); - chat_view_update_temporary(CHAT_VIEW(gtk_bin_get_child(GTK_BIN(widgets->frame_call)))); - } catch(...) { } + if (chatViewConversation_) { + try { + auto contactUri = chatViewConversation_->participants.front(); + auto contactInfo = accountInfo_->contactModel->getContact(contactUri); + chat_view_update_temporary(CHAT_VIEW(gtk_bin_get_child(GTK_BIN(widgets->frame_call)))); + } catch(...) { } + } } } -- GitLab