diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-08-10 22:38:30 +0200 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.com> | 2014-08-10 23:00:44 +0200 |
commit | b58777c8b2b2075a071a25bf9fed0ce7fc0c4401 (patch) | |
tree | 0cfffe643deace8c3defe44ce6c11bd200e706e5 | |
parent | c1b793d501de2c13bd75d28420af4ea772ab336a (diff) |
LOAndroid3: Check if document has been loaded correctly
Change-Id: If4ef82fa18aaa8719391773971d0cde07c0fbcce
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 5e79a77d46c6..c5e2621a0cb5 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -14,7 +14,7 @@ import org.mozilla.gecko.gfx.SubTile; import java.nio.ByteBuffer; public class LOKitTileProvider implements TileProvider { - private static final String LOGTAG = LOKitShell.class.getSimpleName(); + private static final String LOGTAG = LOKitTileProvider.class.getSimpleName(); private final LayerController mLayerController; @@ -49,15 +49,28 @@ public class LOKitTileProvider implements TileProvider { mDocument = mOffice.documentLoad(input); - if(mDocument == null) { - Log.e(LOGTAG, "Error: " + mOffice.getError()); - } else { - Log.i(LOGTAG, "Document parts: " + mDocument.getParts()); - if (mDocument.getParts() >= 1) { + if (checkDocument()) { + int parts = mDocument.getParts(); + Log.i(LOGTAG, "Document parts: " + parts); + if (parts >= 1) { mDocument.setPart(0); } + } + } + + private boolean checkDocument() { + if(mDocument == null || !mOffice.getError().isEmpty()) { + Log.e(LOGTAG, "Error at loading: " + mOffice.getError()); + return false; + } + + if (mDocument.getDocumentWidth() == 0 && mDocument.getDocumentHeight() == 0) { + Log.e(LOGTAG, "Document size zero - last error: " + mOffice.getError()); + } else { Log.i(LOGTAG, "Document size: " + mDocument.getDocumentWidth() + " x " + mDocument.getDocumentHeight()); } + + return true; } @Override |