]> granicus.if.org Git - libass/commitdiff
Fix crash if glyph bitmap rasterization fails
authorGrigori Goronzy <greg@blackbox>
Fri, 14 Aug 2009 11:57:02 +0000 (13:57 +0200)
committerGrigori Goronzy <greg@blackbox>
Fri, 14 Aug 2009 11:57:02 +0000 (13:57 +0200)
Check whether the glyph bitmap used for cache size calculations really
exists.

libass/ass_cache.c

index ac0a00f98955c1c718ab688d445c1aeb7453b39d..643d9912ed2d2819a091a8a5bd345223a304f951 100644 (file)
@@ -226,7 +226,7 @@ void *cache_add_bitmap(Hashmap *bitmap_cache, BitmapHashKey *key,
     // Note: this is only an approximation
     if (val->bm_o)
         bitmap_cache->cache_size += val->bm_o->w * val->bm_o->h * 3;
-    else
+    else if (val->bm)
         bitmap_cache->cache_size += val->bm->w * val->bm->h * 3;
 
     return hashmap_insert(bitmap_cache, key, val);