Gallery: TileImageView: fix NPE
* GetGLRoot() can return null when the job is still running but the GL has already been detached
Change-Id: Ic58b4752f64390efdf14ca1a33a81a8f77100ee0
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
diff --git a/src/com/android/gallery3d/ui/TileImageView.java b/src/com/android/gallery3d/ui/TileImageView.java
index dd4b406..5edd9d7 100644
--- a/src/com/android/gallery3d/ui/TileImageView.java
+++ b/src/com/android/gallery3d/ui/TileImageView.java
@@ -476,7 +476,7 @@
synchronized (this) {
mUploadQueue.push(tile);
}
- if (mTileUploader.mActive.compareAndSet(false, true)) {
+ if (getGLRoot() != null && mTileUploader.mActive.compareAndSet(false, true)) {
getGLRoot().addOnGLIdleListener(mTileUploader);
}
}