diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-10-15 12:08:38 +0300 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-12-04 23:04:21 +0100 |
commit | cdb69d24b8c26915d509d157bf925d996eec3e6d (patch) | |
tree | dc4da43293fc49a6dfd5ca16d10b309367412c1d /android | |
parent | dcc7a9f54f9c525d0efdff8f2142e03a5292bd83 (diff) |
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
Diffstat (limited to 'android')
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 15 |
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); |