Skip to content

Commit 08699f2

Browse files
committed
Fix null pointer dereference in xstepper operator*
1 parent 103dbcd commit 08699f2

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

include/xtensor/core/xiterator.hpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,13 @@ namespace xt
483483
template <class C>
484484
inline auto xstepper<C>::operator*() const -> reference
485485
{
486-
if (m_it == nullptr)
486+
if constexpr (std::is_pointer<subiterator_type>::value)
487487
{
488-
static std::remove_reference_t<reference> sentinel{};
489-
return sentinel;
488+
if (m_it == nullptr)
489+
{
490+
static std::remove_reference_t<reference> sentinel{};
491+
return sentinel;
492+
}
490493
}
491494
return *m_it;
492495
}

0 commit comments

Comments
 (0)