Browse Source

more robust error message handling

David Rose 24 years ago
parent
commit
bf62f009f8
1 changed files with 7 additions and 1 deletions
  1. 7 1
      panda/src/glgsg/glGraphicsStateGuardian.cxx

+ 7 - 1
panda/src/glgsg/glGraphicsStateGuardian.cxx

@@ -3937,7 +3937,13 @@ void report_errors_loop(GLenum error_code) {
 #define MAXGLERRORSREPORTED 20
   int cnt=0;
   while ((cnt<MAXGLERRORSREPORTED) && (error_code != GL_NO_ERROR)) {
-    glgsg_cat.error() << gluErrorString(error_code) << "\n";
+    const GLubyte *error_string = gluErrorString(error_code);
+    if (error_string != (const GLubyte *)NULL) {
+      glgsg_cat.error() << error_string << "\n";
+    } else {
+      glgsg_cat.error()
+        << "Error number " << (int)error_code << "; no string available.\n";
+    }
     error_code = glGetError();
     cnt++;
   }