Commit 92d4cec3c6a638d8afb8d587df60ea606eff7d89

sammy 2008-04-28T09:11:48

* The C constructors now properly return NULL if the C++ constructor failed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/include/FTInternals.h b/include/FTInternals.h
index ac0fc2d..bd64150 100644
--- a/include/FTInternals.h
+++ b/include/FTInternals.h
@@ -96,6 +96,14 @@ static inline FTGLfont *createFTFont(ftglType type, const char *fontname)
             ftgl->ptr = new FTGLTextureFont(fontname);
             break;
     }
+
+    if(ftgl->ptr->Error())
+    {
+        delete ftgl->ptr;
+        free(ftgl);
+        return NULL;
+    }
+
     return ftgl;
 }