https://git.reactos.org/?p=reactos.git;a=commitdiff;h=35dc022e14a9d2eefc89e2a1e4902a1a8d4ee45a

commit 35dc022e14a9d2eefc89e2a1e4902a1a8d4ee45a
Author:     Mark Jansen <[email protected]>
AuthorDate: Sun Aug 4 00:12:34 2019 +0200
Commit:     Mark Jansen <[email protected]>
CommitDate: Sun Aug 4 00:41:12 2019 +0200

    [WIN32SS] Only access a font face if it was actually loaded
---
 win32ss/gdi/ntgdi/freetype.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/win32ss/gdi/ntgdi/freetype.c b/win32ss/gdi/ntgdi/freetype.c
index d31178d3f2e..e953b52db02 100644
--- a/win32ss/gdi/ntgdi/freetype.c
+++ b/win32ss/gdi/ntgdi/freetype.c
@@ -1154,8 +1154,11 @@ IntGdiLoadFontsFromMemory(PGDI_LOAD_FONT pLoadFont)
                                pLoadFont->Memory->BufferSize,
                                -1,
                                &Face);
-    FaceCount = Face->num_faces;
-    FT_Done_Face(Face);
+    if (!Error)
+    {
+        FaceCount = Face->num_faces;
+        FT_Done_Face(Face);
+    }
     IntUnLockFreeType();
 
     if (Error)

Reply via email to