[Libreoffice-commits] core.git: sd/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 15 13:11:47 UTC 2019


 sd/source/ui/dlg/tpaction.cxx |   64 +++++++++++++++++++++---------------------
 1 file changed, 32 insertions(+), 32 deletions(-)

New commits:
commit 7e4c5ddaa6b750dd0b4472958b50134487e1d7ef
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 15 12:15:32 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 15 15:10:42 2019 +0200

    cid#1448231 Explicit null dereferenced
    
    Change-Id: I4cd6cb84b08b7979d537b9590a45ce27a8423d6c
    Reviewed-on: https://gerrit.libreoffice.org/75631
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sd/source/ui/dlg/tpaction.cxx b/sd/source/ui/dlg/tpaction.cxx
index 8eda52babf31..928f39259f82 100644
--- a/sd/source/ui/dlg/tpaction.cxx
+++ b/sd/source/ui/dlg/tpaction.cxx
@@ -621,51 +621,51 @@ IMPL_LINK_NOARG(SdTPAction, CheckFileHdl, weld::Widget&, void)
     if( aFile == aLastFile )
         return;
 
-    // check if it is a valid draw file
-    SfxMedium aMedium( aFile,
-                StreamMode::READ | StreamMode::NOCREATE );
+    bool bHideTreeDocument = true;
 
-    if( aMedium.IsStorage() )
+    if (mpDoc)
     {
-        WaitObject aWait( GetParentDialog() );
+        // check if it is a valid draw file
+        SfxMedium aMedium( aFile,
+                    StreamMode::READ | StreamMode::NOCREATE );
 
-        bool bHideTreeDocument = true;
+        if( aMedium.IsStorage() )
+        {
+            WaitObject aWait( GetParentDialog() );
 
-        // is it a draw file?
-        // open with READ, otherwise the Storages might write into the file!
-        uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage();
-        DBG_ASSERT( xStorage.is(), "No storage!" );
+            // is it a draw file?
+            // open with READ, otherwise the Storages might write into the file!
+            uno::Reference < embed::XStorage > xStorage = aMedium.GetStorage();
+            DBG_ASSERT( xStorage.is(), "No storage!" );
 
-        uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY );
-        if (xAccess.is())
-        {
-            try
+            uno::Reference < container::XNameAccess > xAccess( xStorage, uno::UNO_QUERY );
+            if (xAccess.is())
             {
-                if (xAccess->hasByName(pStarDrawXMLContent) ||
-                    xAccess->hasByName(pStarDrawOldXMLContent))
+                try
                 {
-                    if (SdDrawDocument* pBookmarkDoc = mpDoc->OpenBookmarkDoc(aFile))
+                    if (xAccess->hasByName(pStarDrawXMLContent) ||
+                        xAccess->hasByName(pStarDrawOldXMLContent))
                     {
-                        aLastFile = aFile;
-
-                        m_xLbTreeDocument->clear();
-                        m_xLbTreeDocument->Fill(pBookmarkDoc, aFile);
-                        mpDoc->CloseBookmarkDoc();
-                        m_xLbTreeDocument->show();
-                        bHideTreeDocument = false;
+                        if (SdDrawDocument* pBookmarkDoc = mpDoc->OpenBookmarkDoc(aFile))
+                        {
+                            aLastFile = aFile;
+
+                            m_xLbTreeDocument->clear();
+                            m_xLbTreeDocument->Fill(pBookmarkDoc, aFile);
+                            mpDoc->CloseBookmarkDoc();
+                            m_xLbTreeDocument->show();
+                            bHideTreeDocument = false;
+                        }
                     }
                 }
-            }
-            catch (...)
-            {
+                catch (...)
+                {
+                }
             }
         }
-
-        if (bHideTreeDocument)
-            m_xLbTreeDocument->hide();
-
     }
-    else
+
+    if (bHideTreeDocument)
         m_xLbTreeDocument->hide();
 }
 


More information about the Libreoffice-commits mailing list