Skip to content

Commit

Permalink
Fix undefined access of a vector when empty (#204)
Browse files Browse the repository at this point in the history
Signed-off-by: Kimball Thurston <[email protected]>
  • Loading branch information
kdt3rd authored and cary-ilm committed Sep 1, 2021
1 parent 6191d13 commit ef26308
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/python/PyImath/PyImathFixedVArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ FixedVArray<T>::getitem (Py_ssize_t index)
{
const size_t i = canonical_index (index, _length);
std::vector<T>& data = _ptr[(_indices ? raw_ptr_index(i) : i) * _stride];
return FixedArray<T>(&data[0], data.size(), 1, _writable);
return FixedArray<T>(data.empty() ? nullptr : &data[0], data.size(), 1, _writable);
}

template <class T>
Expand Down

0 comments on commit ef26308

Please sign in to comment.