Browse Source

kill crash when closing window from diving game

Redmond Urbino 19 years ago
parent
commit
4eeaa76c1a
1 changed files with 6 additions and 5 deletions
  1. 6 5
      direct/src/controls/GravityWalker.py

+ 6 - 5
direct/src/controls/GravityWalker.py

@@ -359,11 +359,12 @@ class GravityWalker(DirectObject.DirectObject):
                 self.cTrav.addCollider(self.cEventSphereNodePath, self.event)
                 self.cTrav.addCollider(self.cRayNodePath, self.lifter)
             else:
-                self.cTrav.removeCollider(self.cWallSphereNodePath)
-                if self.wantFloorSphere:
-                    self.cTrav.removeCollider(self.cFloorSphereNodePath)
-                self.cTrav.removeCollider(self.cEventSphereNodePath)
-                self.cTrav.removeCollider(self.cRayNodePath)
+                if hasattr(self, 'cTrav'):
+                    self.cTrav.removeCollider(self.cWallSphereNodePath)
+                    if self.wantFloorSphere:
+                        self.cTrav.removeCollider(self.cFloorSphereNodePath)
+                    self.cTrav.removeCollider(self.cEventSphereNodePath)
+                    self.cTrav.removeCollider(self.cRayNodePath)
 
     def getCollisionsActive(self):
         assert self.debugPrint("getCollisionsActive() returning=%s"%(