Merge "Fix NPE in clearTexture()" into nyc-dev

This commit is contained in:
John Reck
2016-03-17 18:08:47 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -92,6 +92,8 @@ public:
*/
bool init();
bool isInitialized() { return mInitialized; }
/**
* Flush the cache.
*

View File

@@ -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;
}