Author Topic: Fix for UILabel arguement out of range exception  (Read 2281 times)

avatara359

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 8
    • View Profile
Fix for UILabel arguement out of range exception
« on: October 19, 2015, 04:26:17 PM »
Hello, we locally fixed an NGUI in UILabel for an "out of range exception" in "static void OnFontChanged (Font font)"

UILabel:958 for (int i = 0; i < mList.size; ++i) should be for (int i = 0; i < mList.size; i++)

UILabel:983 for (int i = 0, imax = mTempPanelList.Count; i < imax; ++i)
should be for (int i = 0; i < mTempPanelList.Count; i++)

for some reason there is a rare case where mTempPanelList will still get an out of bounds exception even with just a i++ change. This would imply that mTempPanelList is being changed at runtime by something. Logically I don't understand how this can be since its only used as a local temporary space.
« Last Edit: October 19, 2015, 08:14:39 PM by avatara359 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Fix for UILabel arguement out of range exception
« Reply #1 on: October 24, 2015, 04:29:44 AM »
Uh... i++ or ++i, the result is the same. i++ makes a copy of the value that's then returned after the original one gets incremented. ++i increments, then returns, no copy value needs to be created. Regardless of which code is used, the for loop's functionality remains identical.

There is also no "mTempPanelList" in NGUI. You should update...