Quote Originally Posted by masonwheeler
I've got a for loop that goes "for i := 0 to arrayProperty.count - 1 do", and it's supposed to only run if there's at least one unit in the array property being counted. (If the array's size is 0, then the expression evaluates to -1, which is less than 0, and so the for loop should never enter the first iteration.) I know this is supposed to work, because I've done it in the past. But for some reason, now all of a sudden it's entering the first loop no matter what, and sometimes trying to access item [0] of an array that doesn't contain anything.
I figure one of the settings must have come loose somewhere. How do I fix it so it'll behave correctly and not enter the loop the first time unless the condition evaluates true?
IMHO this is an internal error of Delphi 7 compiler (it hasn't occured to me after I moved away from Delphi 7). Usually changing the code somewhere else, moving some parts, etc., exiting Delphi and running it again, then rebuilding the application fixes the problem.

Also make sure you don't overwrite memory in your application as this may trigger weird things to happen like "initialization" code in your unit not being executed, etc.