Commit 40644e3be059638cf1a4ca7a950585b98ba3fe0b

sammy 2008-05-01T14:19:34

* Patches by Sean Morrison, from BzFlag commits r15755 and r14843: + Only delete textures if there is at least one of them. + Ensure that the FTTextureFont data members get set for all cases. * Added Sean to the AUTHORS file.

diff --git a/AUTHORS b/AUTHORS
index 49ba40c..c55d8f4 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -16,6 +16,7 @@ Contributors:
    Robert Bell (pixmap font modifications)
    Sam Hocevar <sam@zoy.org> (build system, new maintainer)
    Éric Beets <ericbeets@free.fr> (C bindings)
+   Sean Morrison (bug fixes, new maintainer)
 
 Bug fixes:
 
diff --git a/src/FTFont/FTTextureFont.cpp b/src/FTFont/FTTextureFont.cpp
index 40248f1..7828bd1 100644
--- a/src/FTFont/FTTextureFont.cpp
+++ b/src/FTFont/FTTextureFont.cpp
@@ -111,7 +111,11 @@ FTTextureFontImpl::FTTextureFontImpl(const unsigned char *pBufferBytes,
 
 FTTextureFontImpl::~FTTextureFontImpl()
 {
-    glDeleteTextures(textureIDList.size(), (const GLuint*)&textureIDList[0]);
+    if(textureIDList.size())
+    {
+        glDeleteTextures(textureIDList.size(),
+                         (const GLuint*)&textureIDList[0]);
+    }
 }
 
 
@@ -160,6 +164,7 @@ void FTTextureFontImpl::CalculateTextureSize()
 {
     if(!maximumGLTextureSize)
     {
+        maximumGLTextureSize = 1024;
         glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint*)&maximumGLTextureSize);
         assert(maximumGLTextureSize); // If you hit this then you have an invalid OpenGL context.
     }