From 8579a1278597eb723c352b703d75bf89aed5ed34 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Mon, 7 Nov 2022 13:46:31 +0100 Subject: [PATCH] Don't crash when trying to add assets with invalid path (closes #2299) --- src/scene/assetmanager.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/scene/assetmanager.cpp b/src/scene/assetmanager.cpp index ddac86157b..ef2e2b8452 100644 --- a/src/scene/assetmanager.cpp +++ b/src/scene/assetmanager.cpp @@ -190,7 +190,14 @@ void AssetManager::update() { ZoneScopedN("Adding queued assets") std::filesystem::path path = generateAssetPath(_assetRootDirectory, asset); - Asset* a = retrieveAsset(path, ""); + Asset* a = nullptr; + try { + a = retrieveAsset(path, ""); + } + catch (const ghoul::RuntimeError& e) { + LERRORC(e.component, e.message); + continue; + } const auto it = std::find(_rootAssets.cbegin(), _rootAssets.cend(), a); if (it != _rootAssets.cend()) {