From 42a57d963513c237d74ebacea756654db4b9d036 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 13 Dec 2017 14:00:19 +0300 Subject: [PATCH] Fix to avoid crash in the issue #2360 --- src/Model/Model_Objects.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index 35df5f681..77fd4bdfa 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -564,6 +564,9 @@ ObjectPtr Model_Objects::object(const std::string& theGroupID, return ObjectPtr(); createHistory(theGroupID); const std::string& aGroupID = groupNameFoldering(theGroupID, theAllowFolder); + const std::vector& aVec = myHistory[theGroupID]; + if (aVec.size() <= theIndex) + return aVec[aVec.size() - 1]; // too high index requested (to avoid crash in #2360) return aGroupID.empty() ? myHistory[theGroupID][theIndex] : myHistory[aGroupID][theIndex]; } -- 2.30.2