summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-10-15 12:08:38 +0300
committerTor Lillqvist <tml@collabora.com>2014-10-15 15:42:01 +0300
commit695f8181efcedd86659ff80500b212bbdb5c8cbc (patch)
treed91babcef082667c319a982cbe9fd47a95c9a3f6
parentCall DetachCurrentThread() in the AndroidSalInstance destructor (diff)
downloadcore-695f8181efcedd86659ff80500b212bbdb5c8cbc.tar.gz
core-695f8181efcedd86659ff80500b212bbdb5c8cbc.zip
If loading a document fails, try restarting the 'main loop' and try again
Does not work, though, we end up with a crash that is hard to debug thanks to the rubbish tool-chain. Change-Id: Ie1954e35e649fac8dd106f0ccbc6951c4a6c1c63
-rw-r--r--android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
index bd1b27bddc24..7e90987efa16 100644
--- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
+++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java
@@ -16,7 +16,7 @@ import java.nio.ByteBuffer;
public class LOKitTileProvider implements TileProvider {
private static final String LOGTAG = LOKitTileProvider.class.getSimpleName();
private static int TILE_SIZE = 256;
- private final Office mOffice;
+ private Office mOffice;
private Document mDocument;
private final LayerController mLayerController;
private final float mTileWidth;
@@ -42,6 +42,19 @@ public class LOKitTileProvider implements TileProvider {
mInputFile = input;
mDocument = mOffice.documentLoad(input);
+ if (mDocument == null) {
+ Log.i(LOGTAG, "====> mOffice.documentLoad() returned null, trying to restart 'Office' and loading again");
+ mOffice.destroy();
+ Log.i(LOGTAG, "====> mOffice.destroy() done");
+ long handle = LibreOfficeKit.getLibreOfficeKitHandle();
+ Log.i(LOGTAG, "====> getLibreOfficeKitHandle() = " + handle);
+ mOffice = new Office(handle);
+ Log.i(LOGTAG, "====> new Office created");
+ mDocument = mOffice.documentLoad(input);
+ }
+
+ Log.i(LOGTAG, "====> mDocument = " + mDocument);
+
if (checkDocument()) {
int parts = mDocument.getParts();
Log.i(LOGTAG, "Document parts: " + parts);