summaryrefslogtreecommitdiff
path: root/libs/hwui/Layer.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-03-17 11:02:07 -0700
committerJohn Reck <jreck@google.com>2016-03-17 11:02:07 -0700
commitdb009173f800bb0d626c42786b5bd0f57cc6545a (patch)
tree1d754611a0bfc0501424c05770c8ad3266724a62 /libs/hwui/Layer.cpp
parentf068cff1761a2876587caa7ca6978a848198439a (diff)
Fix NPE in clearTexture()
Change-Id: I38d261968506ab8b312584c7e688e2b148fadd1f Fixes: 25928378
Diffstat (limited to 'libs/hwui/Layer.cpp')
-rw-r--r--libs/hwui/Layer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index 114347d94357..cdbbbab7730d 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -197,7 +197,12 @@ void Layer::generateTexture() {
}
void Layer::clearTexture() {
- caches.textureState().unbindTexture(texture.mId);
+ // There's a rare possibility that Caches could have been destroyed already
+ // since this method is queued up as a task.
+ // Since this is a reset method, treat this as non-fatal.
+ if (caches.isInitialized()) {
+ caches.textureState().unbindTexture(texture.mId);
+ }
texture.mId = 0;
}