Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

pfGUIListBoxMod::IGetItemFromPoint()'s check relied on an unitialized value #38

Merged
merged 1 commit into from

2 participants

@philippelatulippe

If the search loop failed to find an item, clickItem would be left uninitialized. By my calculations, approximately 0,0001% chance of returning the wrong value! It also caused my debugger to break due to failing a run-time check, hence the patch.

@branan branan merged commit d06271e into from
@Lyrositor Lyrositor referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@dpogue dpogue referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Lunanne Lunanne referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Deledrius Deledrius referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Deledrius Deledrius referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@Lyrositor Lyrositor referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 Sources/Plasma/FeatureLib/pfGameGUIMgr/pfGUIListBoxMod.cpp
View
4 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;
Something went wrong with that request. Please try again.