Browse Source

Merge pull request #87306 from aaronfranke/fix-gltf-buf-view-crash

Fix crash in `GLTFBufferView::load_buffer_view_data`
Rémi Verschelde 1 year ago
parent
commit
29116a81df
1 changed files with 1 additions and 0 deletions
  1. 1 0
      modules/gltf/structures/gltf_buffer_view.cpp

+ 1 - 0
modules/gltf/structures/gltf_buffer_view.cpp

@@ -94,6 +94,7 @@ void GLTFBufferView::set_indices(bool p_indices) {
 }
 }
 
 
 Vector<uint8_t> GLTFBufferView::load_buffer_view_data(const Ref<GLTFState> p_state) const {
 Vector<uint8_t> GLTFBufferView::load_buffer_view_data(const Ref<GLTFState> p_state) const {
+	ERR_FAIL_COND_V(p_state.is_null(), Vector<uint8_t>());
 	ERR_FAIL_COND_V_MSG(byte_stride > 0, Vector<uint8_t>(), "Buffer views with byte stride are not yet supported by this method.");
 	ERR_FAIL_COND_V_MSG(byte_stride > 0, Vector<uint8_t>(), "Buffer views with byte stride are not yet supported by this method.");
 	const TypedArray<Vector<uint8_t>> &buffers = p_state->get_buffers();
 	const TypedArray<Vector<uint8_t>> &buffers = p_state->get_buffers();
 	ERR_FAIL_INDEX_V(buffer, buffers.size(), Vector<uint8_t>());
 	ERR_FAIL_INDEX_V(buffer, buffers.size(), Vector<uint8_t>());