I had a report today from a user, the report (generated by the app) said an OutOfBounds exception happened in this method where the global variable Erln=6 :
Erln=4
if WhichShow=nil then return false
Erln=6
if Cid<0 or Cid>UBound(WhichShow.CatList) then return false 'Cid is an integer, CatList is an array that is a property of WhichShow
Code execution went through the first three lines (through Erln=6) without raising an exception. There aren’t any threads altering the dimensions of CatList, though it’s remotely possible that WhichShow could go nil during execution if the application quits.
How could an OutOfBounds exception have happened here? If checking for bounds isn’t enough to prevent the exception from happening, then what would be?
I can’t see putting Try/Catch/EndTry statements around every single line of code…
Thoughts? Suggestions? I’m stumped…