diff --git a/src/osgPlugins/freetype/FreeTypeLibrary.cpp b/src/osgPlugins/freetype/FreeTypeLibrary.cpp index 8651f2768..2b902721d 100644 --- a/src/osgPlugins/freetype/FreeTypeLibrary.cpp +++ b/src/osgPlugins/freetype/FreeTypeLibrary.cpp @@ -115,11 +115,17 @@ FT_Byte* FreeTypeLibrary::getFace(std::istream& fontstream, unsigned int index, /* empty stream into memory, open that, and keep the pointer in a FreeTypeFont for cleanup */ FT_Byte *buffer = new FT_Byte[static_cast(length)]; + if (!buffer) + { + OSG_WARN<<" .... the font file could not be read, out of memory"<(buffer), length); if (!fontstream || (static_cast(fontstream.gcount()) != length)) { OSG_WARN<<" .... the font file could not be read from its stream"<