From 7a31a1accb7399db8487a73a64e97ce5fef1608d Mon Sep 17 00:00:00 2001 From: sean Date: Tue, 30 Jan 2024 17:39:33 +0100 Subject: [PATCH] Change: Assert when using accessor tools with unloaded buffers (see #45) --- include/fastgltf/tools.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/fastgltf/tools.hpp b/include/fastgltf/tools.hpp index 7b8b528b6..2ce80d950 100644 --- a/include/fastgltf/tools.hpp +++ b/include/fastgltf/tools.hpp @@ -289,7 +289,8 @@ struct DefaultBufferDataAdapter { auto operator()(const Buffer& buffer) const { return std::visit(visitor { [](auto&) -> const std::byte* { - return {}; + assert(false && "Tried accessing a buffer with no data, likely because no buffers were loaded. Perhaps you forgot to specify the LoadExternalBuffers option?"); + return nullptr; }, [&](const sources::Vector& vec) { return reinterpret_cast(vec.bytes.data());