[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [koffice] libs/main: Make sure pDoc isn't null before dereferencing.
From:       "Dr. Robert Marmorstein" <robert () narnia ! homeunix ! com>
Date:       2011-08-02 9:16:39
Message-ID: 20110802091639.8BE2CA60D6 () git ! kde ! org
[Download RAW message or body]

Git commit f747fc4700c07b108246882a4bb778a189386103 by Dr. Robert Marmorstein.
Committed on 01/08/2011 at 18:15.
Pushed by robertm into branch 'master'.

Make sure pDoc isn't null before dereferencing.

The parent document shouldn't ever be null, but why not
be careful?

(We were checking for this anyway, just in the wrong place.)

M  +4    -1    libs/main/KoMainWindow.cpp

http://commits.kde.org/koffice/f747fc4700c07b108246882a4bb778a189386103

diff --git a/libs/main/KoMainWindow.cpp b/libs/main/KoMainWindow.cpp
index 0dc0275..21b56c1 100644
--- a/libs/main/KoMainWindow.cpp
+++ b/libs/main/KoMainWindow.cpp
@@ -1751,8 +1751,11 @@ void KoMainWindow::slotReloadFile()
     if (!bOk)
         return;
 
+    if (!pDoc)
+        return;
+
     KUrl url = pDoc->url();
-    if (pDoc && !pDoc->isEmpty()) {
+    if (!pDoc->isEmpty()) {
         setRootDocument(0);   // don't delete this shell when deleting the document
         if(d->rootDoc)
             d->rootDoc->clearUndoHistory();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic