File fix-crash.patch of Package akregator

From 470801bd845ce6544018c7da9258d1e66ab662fa Mon Sep 17 00:00:00 2001
From: Allen Winter <winter@kde.org>
Date: Wed, 5 Jul 2017 11:49:27 -0400
Subject: akregator_part.cpp - add a crash guard in case the mainWidget isn't
 set yet BUG: 38416

---
 src/akregator_part.cpp | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/akregator_part.cpp b/src/akregator_part.cpp
index 1932a1c..fb6d2b1 100644
--- a/src/akregator_part.cpp
+++ b/src/akregator_part.cpp
@@ -420,7 +420,9 @@ void Part::slotSetStatusText(const QString &statusText)
 
 void Part::saveSettings()
 {
-    m_mainWidget->saveSettings();
+    if (m_mainWidget) {
+        m_mainWidget->saveSettings();
+    }
 }
 
 Part::~Part()
@@ -504,6 +506,10 @@ bool Part::writeToTextFile(const QString &data, const QString &filename) const
 void Part::feedListLoaded(const QSharedPointer<FeedList> &list)
 {
     Q_ASSERT(!m_standardListLoaded);
+    if (!m_mainWidget) {
+        return;
+    }
+
     m_mainWidget->setFeedList(list);
     m_standardListLoaded = list != nullptr;
 
@@ -522,6 +528,10 @@ void Part::feedListLoaded(const QSharedPointer<FeedList> &list)
 
 void Part::flushAddFeedRequests()
 {
+    if (!m_mainWidget) {
+        return;
+    }
+
     for (const AddFeedRequest &i : qAsConst(m_requests)) {
         Q_FOREACH (const QString &j, i.urls) {
             m_mainWidget->addFeedToGroup(j, i.group);
-- 
cgit v0.11.2

openSUSE Build Service is sponsored by