From 0e84751ac9a4f21df9063d88973826dcb6d3d4cd Mon Sep 17 00:00:00 2001 From: lisyarus Date: Wed, 25 Jan 2023 13:01:03 +0300 Subject: [PATCH] Make gfx::gltf_mesh return empty primitive span if mesh wasn't found --- libs/gfx/source/gltf_mesh.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/gfx/source/gltf_mesh.cpp b/libs/gfx/source/gltf_mesh.cpp index 9def1b61..6abfb879 100644 --- a/libs/gfx/source/gltf_mesh.cpp +++ b/libs/gfx/source/gltf_mesh.cpp @@ -45,7 +45,9 @@ namespace psemek::gfx util::span mesh(std::string_view name) const override { - return meshes_.at(name); + if (auto it = meshes_.find(name); it != meshes_.end()) + return it->second; + return {}; } private: