Skip to content

Commit

Permalink
Change: Assert when using accessor tools with unloaded buffers (see #45)
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Jan 30, 2024
1 parent 65e49c2 commit 7a31a1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/fastgltf/tools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const std::byte*>(vec.bytes.data());
Expand Down

1 comment on commit 7a31a1a

@morgankdavis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

Please sign in to comment.