From kde-commits Tue Aug 02 09:16:39 2011 From: "Dr. Robert Marmorstein" Date: Tue, 02 Aug 2011 09:16:39 +0000 To: kde-commits Subject: [koffice] libs/main: Make sure pDoc isn't null before dereferencing. Message-Id: <20110802091639.8BE2CA60D6 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=131227666215658 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();