From b6b423bd8fc2085d711840b4e1994b34ddef8c01 Mon Sep 17 00:00:00 2001 From: LaurentGom Date: Tue, 19 Jan 2010 22:19:29 +0000 Subject: [PATCH] Fixed possible crash in sf::Font git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1364 4e206d99-4929-0410-ac5d-dfc041789085 --- src/SFML/Graphics/Font.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SFML/Graphics/Font.cpp b/src/SFML/Graphics/Font.cpp index 596d72120..cbe170e33 100644 --- a/src/SFML/Graphics/Font.cpp +++ b/src/SFML/Graphics/Font.cpp @@ -179,6 +179,10 @@ const Glyph& Font::GetGlyph(Uint32 codePoint, unsigned int characterSize, bool b //////////////////////////////////////////////////////////// int Font::GetKerning(Uint32 first, Uint32 second, unsigned int characterSize) const { + // Special case where first or second is 0 (null character) + if (first == 0 || second == 0) + return 0; + FT_Face face = static_cast(myFace); if (face && FT_HAS_KERNING(face) && SetCurrentSize(characterSize))