Fix T67117: Font thumbnails crash to desktop
authorSebastian Parborg <darkdefende@gmail.com>
Wed, 24 Jul 2019 09:26:21 +0000 (11:26 +0200)
committerSebastian Parborg <darkdefende@gmail.com>
Wed, 24 Jul 2019 09:26:21 +0000 (11:26 +0200)
We were missing a null pointer check for invalid fonts.

source/blender/blenfont/intern/blf_glyph.c

index 049af7678d51308f41b05eba02495a898ef276d6..66be94aaa06be342b52b1891fb1c08ba7ec80aa8 100644 (file)
@@ -96,7 +96,7 @@ KerningCacheBLF *blf_kerning_cache_new(FontBLF *font)
           .x = 0,
           .y = 0,
       };
-      if (g_prev && FT_Get_Kerning(font->face, g_prev->idx, g->idx, kc->mode, &delta) == 0) {
+      if (g && g_prev && FT_Get_Kerning(font->face, g_prev->idx, g->idx, kc->mode, &delta) == 0) {
         kc->table[i][j] = (int)delta.x >> 6;
       }
       else {