Fix possible crash when texture is NULL in the drop shadow cache.
Change-Id: I2142c55dbcfebcdf013a7f4ae04b266a60f5ce8a
diff --git a/libs/hwui/TextDropShadowCache.cpp b/libs/hwui/TextDropShadowCache.cpp
index 9d54277..2f7c7be 100644
--- a/libs/hwui/TextDropShadowCache.cpp
+++ b/libs/hwui/TextDropShadowCache.cpp
@@ -74,10 +74,10 @@
///////////////////////////////////////////////////////////////////////////////
void TextDropShadowCache::operator()(ShadowText& text, ShadowTexture*& texture) {
- const uint32_t size = texture->width * texture->height;
- mSize -= size;
-
if (texture) {
+ const uint32_t size = texture->width * texture->height;
+ mSize -= size;
+
glDeleteTextures(1, &texture->id);
delete texture;
}