Browse Source

try fix segfault (sorry!)

rdb 12 years ago
parent
commit
56334e73e8
1 changed files with 12 additions and 3 deletions
  1. 12 3
      panda/src/pgraph/renderState.I

+ 12 - 3
panda/src/pgraph/renderState.I

@@ -550,10 +550,19 @@ operator = (const Attribute &copy) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 INLINE int RenderState::Attribute::
 INLINE int RenderState::Attribute::
 compare_to(const Attribute &other) const {
 compare_to(const Attribute &other) const {
-  int c = _attrib->compare_to(*other._attrib);
-  if (c != 0) {
-    return c;
+  if (_attrib != other._attrib) {
+    if (_attrib == NULL) {
+      return -1;
+    } else if (other._attrib == NULL) {
+      return 1;
+    }
+
+    int c = _attrib->compare_to(*other._attrib);
+    if (c != 0) {
+      return c;
+    }
   }
   }
+
   return _override - other._override;
   return _override - other._override;
 }
 }