summaryrefslogtreecommitdiff
path: root/sfx2/source/control
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-15 19:30:18 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-15 22:17:19 +0200
commit5d111672ae58e35b7856bc2578352ebdc3ab6ecd (patch)
treed7c204f901d4d81e40604b25161095c38a16a6ce /sfx2/source/control
parentfaadf7c15593521c0ebceb043f82f916ee5ccf9d (diff)
null-deref in SfxViewShell::isBlockedCommand
Change-Id: I43db7fabcc32971f951cc72dc9b1d22eba8df357 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166094 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sfx2/source/control')
-rw-r--r--sfx2/source/control/unoctitm.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index f49dc2d7336f..9cbd29034a46 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -532,18 +532,21 @@ void SfxDispatchController_Impl::dispatch( const css::util::URL& aURL,
SolarMutexGuard aGuard;
- if (comphelper::LibreOfficeKit::isActive() &&
- SfxViewShell::Current()->isBlockedCommand(aURL.Complete))
+ if (comphelper::LibreOfficeKit::isActive())
{
- tools::JsonWriter aTree;
- aTree.put("code", "");
- aTree.put("kind", "BlockedCommand");
- aTree.put("cmd", aURL.Complete);
- aTree.put("message", "Blocked feature");
- aTree.put("viewID", SfxViewShell::Current()->GetViewShellId().get());
-
- SfxViewShell::Current()->libreOfficeKitViewCallback(LOK_COMMAND_BLOCKED, aTree.finishAndGetAsOString());
- return;
+ const SfxViewShell* pViewShell = SfxViewShell::Current();
+ if (pViewShell && pViewShell->isBlockedCommand(aURL.Complete))
+ {
+ tools::JsonWriter aTree;
+ aTree.put("code", "");
+ aTree.put("kind", "BlockedCommand");
+ aTree.put("cmd", aURL.Complete);
+ aTree.put("message", "Blocked feature");
+ aTree.put("viewID", pViewShell->GetViewShellId().get());
+
+ pViewShell->libreOfficeKitViewCallback(LOK_COMMAND_BLOCKED, aTree.finishAndGetAsOString());
+ return;
+ }
}
if (