Kaydet (Commit) cdb69d24 authored tarafından Tor Lillqvist's avatar Tor Lillqvist Kaydeden (comit) Tomaž Vajngerl

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
üst dcc7a9f5
...@@ -16,7 +16,7 @@ import java.nio.ByteBuffer; ...@@ -16,7 +16,7 @@ import java.nio.ByteBuffer;
public class LOKitTileProvider implements TileProvider { public class LOKitTileProvider implements TileProvider {
private static final String LOGTAG = LOKitTileProvider.class.getSimpleName(); private static final String LOGTAG = LOKitTileProvider.class.getSimpleName();
private static int TILE_SIZE = 256; private static int TILE_SIZE = 256;
private final Office mOffice; private Office mOffice;
private Document mDocument; private Document mDocument;
private final LayerController mLayerController; private final LayerController mLayerController;
private final float mTileWidth; private final float mTileWidth;
...@@ -42,6 +42,19 @@ public class LOKitTileProvider implements TileProvider { ...@@ -42,6 +42,19 @@ public class LOKitTileProvider implements TileProvider {
mInputFile = input; mInputFile = input;
mDocument = mOffice.documentLoad(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()) { if (checkDocument()) {
int parts = mDocument.getParts(); int parts = mDocument.getParts();
Log.i(LOGTAG, "Document parts: " + parts); Log.i(LOGTAG, "Document parts: " + parts);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment