Commit 7e2c7214f72139f9ce5855b04b0735d4804e0984

henry 2001-11-05T20:59:35

Added a test for null pointers in the d_stor

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);