diff --git a/src/ft2font.cpp b/src/ft2font.cpp index 0fb3b8b65825..1d94adf26d40 100644 --- a/src/ft2font.cpp +++ b/src/ft2font.cpp @@ -846,6 +846,7 @@ PYCXX_NOARGS_METHOD_DECL(FT2Font, get_path) FT2Font::FT2Font(Py::PythonClassInstance *self, Py::Tuple &args, Py::Dict &kwds) : Py::PythonClass(self, args, kwds), + face(NULL), image() { FT_Open_Args open_args; @@ -975,11 +976,13 @@ FT2Font::~FT2Font() { _VERBOSE("FT2Font::~FT2Font"); - FT_Done_Face(face); + if (face) { + FT_Done_Face(face); - for (size_t i = 0; i < glyphs.size(); i++) - { - FT_Done_Glyph(glyphs[i]); + for (size_t i = 0; i < glyphs.size(); i++) + { + FT_Done_Glyph(glyphs[i]); + } } }