Added a test for null pointers in the d_stor
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
diff --git a/src/FTGlyphContainer.cpp b/src/FTGlyphContainer.cpp
index 1722cd4..710e253 100755
--- a/src/FTGlyphContainer.cpp
+++ b/src/FTGlyphContainer.cpp
@@ -10,8 +10,11 @@ FTGlyphContainer::FTGlyphContainer( FTFace* f, unsigned int g, bool p)
err( 0)
{
glyphs.reserve( g);
+
for( unsigned int i = 0; i < g; ++i)
+ {
glyphs.push_back( NULL);
+ }
}
@@ -20,7 +23,10 @@ FTGlyphContainer::~FTGlyphContainer()
vector<FTGlyph*>::iterator iter;
for( iter = glyphs.begin(); iter != glyphs.end(); ++iter)
{
- delete *iter;
+ if( *iter)
+ {
+ delete *iter;
+ }
}
glyphs.clear();
@@ -29,9 +35,6 @@ FTGlyphContainer::~FTGlyphContainer()
bool FTGlyphContainer::Add( FTGlyph* tempGlyph, unsigned int g)
{
- // At the moment we are using a vector. Vectors don't return bool.
-// unsigned int glyphIndex = face->CharIndex( g);
-
glyphs[g] = tempGlyph;
return true;
}
@@ -43,6 +46,7 @@ FTGlyph* FTGlyphContainer::Glyph( unsigned int c) const
return glyphs[g];
}
+
float FTGlyphContainer::Advance( unsigned int index, unsigned int next)
{
unsigned int left = face->CharIndex( index);