From 63a499c76b4888b1514ea595036236f03ec90676 Mon Sep 17 00:00:00 2001 From: digant73 Date: Sat, 26 Apr 2025 15:32:49 +0200 Subject: [PATCH] fix erase_if method --- rpcs3/Emu/RSX/Common/simple_array.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/simple_array.hpp b/rpcs3/Emu/RSX/Common/simple_array.hpp index 24217be42c..04a2ec9214 100644 --- a/rpcs3/Emu/RSX/Common/simple_array.hpp +++ b/rpcs3/Emu/RSX/Common/simple_array.hpp @@ -390,7 +390,7 @@ namespace rsx } bool ret = false; - for (auto ptr = _data, last = _data + _size - 1; ptr <= last; ptr++) + for (auto ptr = _data, last = _data + (_size - 1); ptr <= last; ptr++) { if (predicate(*ptr)) { @@ -405,7 +405,7 @@ namespace rsx // Move item to the end of the list and shrink by 1 std::memcpy(ptr, last, sizeof(Ty)); - last = _data + (--_size); + last = _data + (--_size - 1); // set new last } }