Hi Steve,
That's another division by zero, when the pagemax variable didn't get passed as 10 because of the typo in the sub call. The thing is, you can take that line out, which I agree would be the first division by zero encounter, and leave the MOD line in; it will still crash. So, that's a bit of a red herring. The crash is only eliminated when the SELECT CASE is removed, and that's weird, because that part of the program flow isn't even reached yet. Try this. Remove those 4 lines and it won't crash, it will just properly trap the division by zero error.
Hi Fell,
I tried it in version 1.2 just now, and got the same crash results. Like I mentioned, If I take the integer division out, and leave the MOD, it still crashes. Now here's an interesting one. I took both MOD and the integer division out, and substituted in PRINT 0 / 0. It actually completed, and printed: NAN D
Now if I substitute in PRINT 0 \ 0 (integer division) it crashes again, with reporting a division by zero error. It's just really odd that it's the presence of the not yet engaged...
SELECT CASE a$(j)
CASE "<!--ID-->"
a$(j) = "1"
END SELECT
... is what makes it crash. When I take those four lines out, it prevents the crash, and simply reports the division by zero error.
Hi Mark,
Yes, I knew about the variable typo. I fixed it before I made this thread, but I made the thread to point out the crash the division by zero caused. As you can see, Fell's system didn't crash, so this is a hard one to pin down. Also, yes, I know the other variables are empty, not defined, etc., but that's because I whittled this down from a 500 line sub. I left them as is, because they are not involved in the crash. What makes it crash is when the division by zero is encountered, and get this... only in the presence of that SELECT CASE code, which doesn't even come about in the program flow, until after the division by zero is encountered. So my concern is why does having those four lines crash it, and when those 4 lines are removed, it throws the appropriate division by zero error?
------------------------------------------------
I guess we chalk this one up as some rare oddity that hopefully won't ever affect a program without a coding error causing it.
Anyway, thanks for having a look guys,
Pete