Commit 7890686d8082b914f86f12de5cf8c61248b17eff

David Turner 2007-05-22T14:08:09

fix crash when not using the bytecode interpreter with TrueType fonts

diff --git a/ChangeLog b/ChangeLog
index dd8c99e..dd600cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-05-22  David Turner  <david@freetype.org>
 
+	* src/truetype/ttgload.c: fix Werner's recent graphics state
+	patch to avoid crashes when we don't use the bytecode interpreter !
+
 	* src/lzw/ftzopen.h, src/lzw/ftzopen.c: fix for bug #19910
 	(heap blowup with very large .Z font file). The .Z format is
 	*really* crappy :-(
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 1f75a2c..6e9cc80 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1382,7 +1382,10 @@
 
         FT_Stream         old_stream     = loader->stream;
 
-        TT_GraphicsState  saved_GS       = loader->exec->GS;
+        TT_GraphicsState  saved_GS;
+
+        if (loader->exec)
+          saved_GS = loader->exec->GS;
 
 
         FT_GlyphLoader_Add( gloader );
@@ -1394,7 +1397,8 @@
 
 
           /* reinitialize graphics state */
-          loader->exec->GS = saved_GS;
+          if (loader->exec)
+            loader->exec->GS = saved_GS;
 
           /* Each time we call load_truetype_glyph in this loop, the   */
           /* value of `gloader.base.subglyphs' can change due to table */