summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/source/lib/init.cxx19
-rw-r--r--sfx2/source/view/lokhelper.cxx4
2 files changed, 19 insertions, 4 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f4f46221f7b0..5f7ac7a6a384 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1365,7 +1365,10 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis,
// Disable callbacks while we are painting.
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
- std::size_t nView = SfxLokHelper::getView();
+ int nView = SfxLokHelper::getView();
+ if (nView < 0)
+ return;
+
pDocument->mpCallbackFlushHandlers[nView]->setPartTilePainting(true);
try
{
@@ -1438,7 +1441,10 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
SolarMutexGuard aGuard;
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
- std::size_t nView = SfxLokHelper::getView();
+ int nView = SfxLokHelper::getView();
+ if (nView < 0)
+ return;
+
pDocument->mpCallbackFlushHandlers[nView].reset(new CallbackFlushHandler(pThis, pCallback, pData));
if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell())
@@ -1507,7 +1513,9 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
std::vector<beans::PropertyValue> aPropertyValuesVector(jsonToPropertyValuesVector(pArguments));
- std::size_t nView = SfxLokHelper::getView();
+ int nView = SfxLokHelper::getView();
+ if (nView < 0)
+ return;
// handle potential interaction
if (gImpl && aCommand == ".uno:Save")
@@ -1593,7 +1601,10 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX,
}
LibLODocument_Impl* pLib = static_cast<LibLODocument_Impl*>(pThis);
- std::size_t nView = SfxLokHelper::getView();
+ int nView = SfxLokHelper::getView();
+ if (nView < 0)
+ return;
+
if (pLib->mpCallbackFlushHandlers[nView])
{
pLib->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr());
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index c5fb171f246b..822547469799 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -83,6 +83,10 @@ int SfxLokHelper::getView(SfxViewShell* pViewShell)
{
if (!pViewShell)
pViewShell = SfxViewShell::Current();
+ // Still no valid view shell? Then no idea.
+ if (!pViewShell)
+ return -1;
+
return pViewShell->GetViewShellId();
}