Browse Source

gobj: fix crash printing out residency trackers

rdb 6 years ago
parent
commit
ccca3cca3a
2 changed files with 14 additions and 2 deletions
  1. 7 1
      panda/src/gobj/indexBufferContext.cxx
  2. 7 1
      panda/src/gobj/vertexBufferContext.cxx

+ 7 - 1
panda/src/gobj/indexBufferContext.cxx

@@ -20,7 +20,13 @@ TypeHandle IndexBufferContext::_type_handle;
  */
 void IndexBufferContext::
 output(std::ostream &out) const {
-  out << *get_data() << ", " << get_data_size_bytes();
+  GeomPrimitive *prim = get_data();
+  if (prim != nullptr) {
+    out << *prim;
+  } else {
+    out << "NULL";
+  }
+  out << ", " << get_data_size_bytes();
 }
 
 /**

+ 7 - 1
panda/src/gobj/vertexBufferContext.cxx

@@ -21,7 +21,13 @@ TypeHandle VertexBufferContext::_type_handle;
  */
 void VertexBufferContext::
 output(std::ostream &out) const {
-  out << *get_data() << ", " << get_data_size_bytes();
+  GeomVertexArrayData *data = get_data();
+  if (data != nullptr) {
+    out << *data;
+  } else {
+    out << "NULL";
+  }
+  out << ", " << get_data_size_bytes();
 }
 
 /**