The code that you found crashing, probably once worked.
And it was probably not changed since it worked. Some other code, somewhere else may have been changed, and as a result of that the bug was introduced.
And yes, the code you tried to use, then escaped the proper testing.
Well, we try to test things as good as possible. But there are very few regular developers. And Lazarus is not a commercial enterprise, so developers do not get paid for the work[1]. They spent the day on a regular job, and only have a few hours over the week to spent on Lazarus.
In that time, more than a million lines of code must be maintained, fixed, extended, tested ...
[1]This is *NOT* to say, that we do not want to test. We do. It only explains that we have to fit it into very limited time.