diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-05-12 21:17:57 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-05-13 11:38:42 +0200 |
commit | 439a78496a9a45c6e412fa93edb537727ab7862a (patch) | |
tree | 7b6573b949c88bf6bbd1816eebb684f06058e003 /sd/source/ui/view/drviewsk.cxx | |
parent | 2ac8bf040be16eea79b1386a9466a058deee330f (diff) |
cid#1530046 Unchecked dynamic_cast
Change-Id: Iaeec0f90e6faae8f7c5ab8e1745c8bdb62925ca5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151714
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source/ui/view/drviewsk.cxx')
-rw-r--r-- | sd/source/ui/view/drviewsk.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sd/source/ui/view/drviewsk.cxx b/sd/source/ui/view/drviewsk.cxx index 673416aff4f7..607b59d25111 100644 --- a/sd/source/ui/view/drviewsk.cxx +++ b/sd/source/ui/view/drviewsk.cxx @@ -23,19 +23,21 @@ void DrawViewShell::ConfigurationChanged( utl::ConfigurationBroadcaster* pCb, Co { svtools::ColorConfig *pColorConfig = dynamic_cast<svtools::ColorConfig*>(pCb); ConfigureAppBackgroundColor(pColorConfig); - SfxViewShell* pCurrentShell = SfxViewShell::Current(); - if (comphelper::LibreOfficeKit::isActive() && pCurrentShell) + if (comphelper::LibreOfficeKit::isActive()) { - DrawViewShell* pCurrentDrawShell = nullptr; + SfxViewShell* pCurrentShell = SfxViewShell::Current(); ViewShellBase* pShellBase = dynamic_cast<ViewShellBase*>(pCurrentShell); - if(pShellBase) - pCurrentDrawShell = dynamic_cast<DrawViewShell*>(pShellBase->GetMainViewShell().get()); - pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; - pCurrentDrawShell->maViewOptions.msColorSchemeName = pColorConfig->GetCurrentSchemeName(); + if (!pShellBase) + return; + if (DrawViewShell* pCurrentDrawShell = dynamic_cast<DrawViewShell*>(pShellBase->GetMainViewShell().get())) + { + pCurrentDrawShell->maViewOptions.mnDocBackgroundColor = pColorConfig->GetColorValue(svtools::DOCCOLOR).nColor; + pCurrentDrawShell->maViewOptions.msColorSchemeName = pColorConfig->GetCurrentSchemeName(); + } SdXImpressDocument* pDoc = comphelper::getFromUnoTunnel<SdXImpressDocument>(pCurrentShell->GetCurrentDocument()); SfxLokHelper::notifyViewRenderState(pCurrentShell, pDoc); Color aFillColor(pColorConfig->GetColorValue(svtools::APPBACKGROUND).nColor); - SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, + pCurrentShell->libreOfficeKitViewCallback(LOK_CALLBACK_APPLICATION_BACKGROUND_COLOR, aFillColor.AsRGBHexString().toUtf8()); } } |