From ccbedc63063e2ce31ce7155c8e27c005049d973f Mon Sep 17 00:00:00 2001 From: philippelatulippe Date: Sun, 15 May 2011 21:49:51 -0400 Subject: [PATCH] Fix read of unitialized variable if a GUI element is not found. --- Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp index e7463a2a..c9824920 100644 --- a/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp +++ b/Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp @@ -766,7 +766,7 @@ Int32 pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt ) hsPoint3 localPt = mousePt; // despite getting a ref to the point (why?) we do NOT want to modify it IScreenToLocalPt( localPt ); UInt32 i; - Int16 clickItem, clickY = (Int16)( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) ); + Int16 clickItem = -1 , clickY = (Int16)( localPt.fY * ( fDynTextMap->GetVisibleHeight() - 1 ) ); Int16 clickX = (Int16)( localPt.fX * ( fDynTextMap->GetVisibleWidth() - 1 ) ); // We have a nice array that has the starting (top) Y's of each visible element. So we just @@ -791,7 +791,7 @@ Int32 pfGUIListBoxMod::IGetItemFromPoint( hsPoint3 &mousePt ) } } - if( clickItem > fElements.GetCount() - 1 || clickItem < 0 ) + if( clickItem > fElements.GetCount() - 1 ) clickItem = -1; return clickItem;