From cae745378dab218ab499eddc4a72c3481921639b Mon Sep 17 00:00:00 2001 From: Sandu Liviu Catalin Date: Sun, 19 Sep 2021 14:21:57 +0300 Subject: [PATCH] Update Utilities.hpp --- module/Library/DPP/Utilities.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/module/Library/DPP/Utilities.hpp b/module/Library/DPP/Utilities.hpp index 13647d70..fffd261b 100644 --- a/module/Library/DPP/Utilities.hpp +++ b/module/Library/DPP/Utilities.hpp @@ -169,7 +169,21 @@ template < class T, class W > struct DpVectorProxy // Return the object from the cache return mVec[static_cast< size_t >(i)].first; } - SQMOD_NODISCARD LightObj & Get(SQInteger i) { ValidIdx_(i); return Get_(i); } + SQMOD_NODISCARD LightObj & Get(SQInteger i) + { + // Was the referenced vector modified? + if (mVec.size() < Valid().size()) + { + // Synchronize the size + mVec.resize(mPtr->size()); + // Synchronize the cache + CacheSync(); + } + // Validate index + ValidIdx_(i); + // Perform the request + return Get_(i); + } /* -------------------------------------------------------------------------------------------- * Modify a value from the container. */