Browse Source

PhysxManager.get_global_ptr now returns NULL is SDK initialization fails.

enn0x 15 years ago
parent
commit
c7bdb4ae1b
1 changed files with 7 additions and 1 deletions
  1. 7 1
      panda/src/physx/physxManager.cxx

+ 7 - 1
panda/src/physx/physxManager.cxx

@@ -40,6 +40,7 @@ PhysxManager() {
   else {
     physx_cat.error() << "Error when setting up the PhysX subsystem: "
                       << get_sdk_error_string(error) << endl;
+    _sdk = NULL;
   }
 
   nassertv_always(error == NXCE_NO_ERROR);
@@ -106,7 +107,12 @@ get_global_ptr() {
     _global_ptr = new PhysxManager;
   }
 
-  return _global_ptr;
+  if (_global_ptr->_sdk == NULL) {
+    return NULL;
+  }
+  else {
+    return _global_ptr;
+  }
 }
 
 ////////////////////////////////////////////////////////////////////