Delphi / Object Pascal · Exception
What does Runtime Error 201: ERangeError mean in Delphi / Object Pascal?
A value was assigned that falls outside the declared range of its type, most often an array index or an ordinal type with a restricted range, and range checking ($R+) was enabled when the assignment happened.
A value was assigned that falls outside the declared range of its type, most often an array index or an ordinal type with a restricted range, and range checking ($R+) was enabled when the assignment happened.
Check the value against the type's declared bounds before the assignment. Range checking is a compile-time switch; if it is off in release builds, the same bad value will not raise this error there, it will simply corrupt memory instead, which is worse, so treat this as a bug to fix, not a check to disable.