Blob Blame History Raw
From ad9dac7f0a8c7f2e9225a519334a274c215ad351 Mon Sep 17 00:00:00 2001
From: Miklos Vajna <vmiklos@collabora.co.uk>
Date: Thu, 8 Oct 2015 10:27:53 +0200
Subject: [PATCH 193/398] lok::Document::initializeForRendering(): handle lack
 of lok_init()

Normally lok_init() sets the component context, but not e.g. during unit
testing.

Change-Id: If3760f31af2e4b870f65e5aa7557607e8b6a1114
(cherry picked from commit de1f156c6a35757d74b0e337b02743f1962ff0ae)
---
 desktop/source/lib/init.cxx | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 836fc00e1042..b69e58a4af1f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -568,6 +568,14 @@ static void doc_iniUnoCommands ()
         return;
     }
 
+    if (!xContext.is())
+        xContext = comphelper::getProcessComponentContext();
+    if (!xContext.is())
+    {
+        SAL_WARN("lok", "iniUnoCommands: Component context is not available");
+        return;
+    }
+
     SfxSlotPool& rSlotPool = SfxSlotPool::GetSlotPool(pViewFrame);
     uno::Reference<util::XURLTransformer> xParser(util::URLTransformer::create(xContext));
 
-- 
2.12.0