Commit 7abb7502ca1ae9da3a995c96b8593734c1c16e62

sammy 2008-05-19T10:06:49

* Do not crash if the face has no charmaps. Bug found using zzuf: xvfb-run zzuf -q -F5 -r0.0000001:0.1 -s0:10000 -c CTest EunjinNakseo.ttf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/FTCharmap.cpp b/src/FTCharmap.cpp
index b09045b..d0a0433 100644
--- a/src/FTCharmap.cpp
+++ b/src/FTCharmap.cpp
@@ -35,6 +35,13 @@ FTCharmap::FTCharmap(FTFace* face)
 {
     if(!ftFace->charmap)
     {
+        if(!ftFace->num_charmaps)
+        {
+            // This face doesn't even have one charmap!
+            err = 0x96; // Invalid_CharMap_Format
+            return;
+        }
+
         err = FT_Set_Charmap(ftFace, ftFace->charmaps[0]);
     }