From 08f2f0f82ff043606fa70c05775596ee6d287ba8 Mon Sep 17 00:00:00 2001 From: Jan Krassnigg Date: Fri, 18 Nov 2022 13:44:05 +0100 Subject: [PATCH] Don't hide out-of-memory during FBX import --- code/AssetLib/FBX/FBXDocument.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/AssetLib/FBX/FBXDocument.cpp b/code/AssetLib/FBX/FBXDocument.cpp index d5e17d3e6..957aa764f 100644 --- a/code/AssetLib/FBX/FBXDocument.cpp +++ b/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;