sd/source/core/drawdoc2.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 168fadadbc8aceb9e2247a06918ac6ed8d000fa5
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Jan 22 13:04:21 2026 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jan 23 10:03:56 2026 +0100

    cid#1680361 Unchecked dynamic_cast
    
    Change-Id: I49268b245038541c007cb714cdc2309aba2440ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197812
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 88612cc7e640..da94ff711768 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -516,9 +516,10 @@ rtl::Reference<SdrPage> 
SdDrawDocument::RemovePage(sal_uInt16 nPgNum)
     auto pSdPage = static_cast<SdPage*>(pPage.get());
     if (pSdPage->IsCanvasPage())
     {
-        if (comphelper::LibreOfficeKit::isActive())
+        DrawViewShell* pDrawViewSh = comphelper::LibreOfficeKit::isActive() ?
+            dynamic_cast<DrawViewShell*>(mpDocSh->GetViewShell()) : nullptr;
+        if (pDrawViewSh)
         {
-            DrawViewShell* pDrawViewSh = 
dynamic_cast<DrawViewShell*>(mpDocSh->GetViewShell());
             pDrawViewSh->RememberCanvasPageVisArea(::tools::Rectangle());
         }
         mpCanvasPage = nullptr;

Reply via email to