android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
New commits: commit b57a321551e65783d083213ada48be91c27e461e Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jan 21 14:55:27 2015 +0100 android: fix crash in tile provider while closing the document The problem was that for large documents if "back" was pressed quickly, then we closed the document, but rendering thumbnails for the different parts was still in progress. Just make sure we don't crash when the underlying document is gone. E/AndroidRuntime( 8902): java.lang.NullPointerException E/AndroidRuntime( 8902): at org.libreoffice.LOKitTileProvider.thumbnail(LOKitTileProvider.java:244) E/AndroidRuntime( 8902): at org.libreoffice.ThumbnailCreator$ThumbnailCreationTask.getThumbnail(ThumbnailCreator.java:78) E/AndroidRuntime( 8902): at org.libreoffice.LOKitThread.createThumbnail(LOKitThread.java:170) E/AndroidRuntime( 8902): at org.libreoffice.LOKitThread.processEvent(LOKitThread.java:148) E/AndroidRuntime( 8902): at org.libreoffice.LOKitThread.run(LOKitThread.java:120) Change-Id: I93e8e1ea19545ca196ef6f59d19528bb42f3676d diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 0970bbb..78a592b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -241,7 +241,8 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback Log.w(LOGTAG, "Thumbnail size: " + getPageWidth() + " " + getPageHeight() + " " + widthPixel + " " + heightPixel); ByteBuffer buffer = ByteBuffer.allocateDirect(widthPixel * heightPixel * 4); - mDocument.paintTile(buffer, widthPixel, heightPixel, 0, 0, (int) mWidthTwip, (int) mHeightTwip); + if (mDocument != null) + mDocument.paintTile(buffer, widthPixel, heightPixel, 0, 0, (int) mWidthTwip, (int) mHeightTwip); Bitmap bitmap = Bitmap.createBitmap(widthPixel, heightPixel, Bitmap.Config.ARGB_8888); bitmap.copyPixelsFromBuffer(buffer); @@ -287,12 +288,18 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback @Override public void changePart(int partIndex) { + if (mDocument == null) + return; + mDocument.setPart(partIndex); resetDocumentSize(); } @Override public int getCurrentPartNumber() { + if (mDocument == null) + return 0; + return mDocument.getPart(); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits