Parcourir la source

Don't hide out-of-memory during FBX import

Jan Krassnigg il y a 2 ans
Parent
commit
08f2f0f82f
1 fichiers modifiés avec 8 ajouts et 0 suppressions
  1. 8 0
      code/AssetLib/FBX/FBXDocument.cpp

+ 8 - 0
code/AssetLib/FBX/FBXDocument.cpp

@@ -199,6 +199,14 @@ const Object* LazyObject::Get(bool dieOnError) {
             object.reset(new AnimationCurveNode(id,element,name,doc));
         }
     }
+    catch (std::bad_alloc&) {
+        // out-of-memory is unrecoverable and should always lead to a failure
+
+        flags &= ~BEING_CONSTRUCTED;
+        flags |= FAILED_TO_CONSTRUCT;
+
+        throw;
+    }
     catch(std::exception& ex) {
         flags &= ~BEING_CONSTRUCTED;
         flags |= FAILED_TO_CONSTRUCT;