From ac9c66047c1dd9b959355018820bec75da1eff0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 19 Sep 2024 13:38:02 +0200 Subject: [PATCH] Extract `pItem` variable to avoid duplicate `GetItem` call --- src/engine/shared/snapshot.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/shared/snapshot.cpp b/src/engine/shared/snapshot.cpp index 5d1222357..99d2b50cc 100644 --- a/src/engine/shared/snapshot.cpp +++ b/src/engine/shared/snapshot.cpp @@ -742,8 +742,11 @@ int *CSnapshotBuilder::GetItemData(int Key) { for(int i = 0; i < m_NumItems; i++) { - if(GetItem(i)->Key() == Key) - return GetItem(i)->Data(); + CSnapshotItem *pItem = GetItem(i); + if(pItem->Key() == Key) + { + return pItem->Data(); + } } return nullptr; }