From abebac8bd4c60c8a25a8e4fa76c1e260f741daeb Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 17 Jul 2022 12:22:10 +0200 Subject: [PATCH] Return nullptr pointer for empty core::array fixes minetest/minetest#12532 --- include/irrArray.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/irrArray.h b/include/irrArray.h index dbad8c8..3b36401 100644 --- a/include/irrArray.h +++ b/include/irrArray.h @@ -227,7 +227,7 @@ public: /** \return Pointer to the array. */ T* pointer() { - return &m_data[0]; + return m_data.empty() ? nullptr : &m_data[0]; } @@ -235,7 +235,7 @@ public: /** \return Pointer to the array. */ const T* const_pointer() const { - return &m_data[0]; + return m_data.empty() ? nullptr : &m_data[0]; }