I'm working with some legacy spaghetti code that processes some hairy EDI. Most of the code is indecipherable and has no indentation or comments or even good variable names but there's one line that gives me trouble when I remove the On Error Resume Next
statement which causes the script to always timeout.
If UBound(arylin) >= 1 Then
Do Until arylin(0) = "PB" and arylin(1) = "DEF"
' Processing goes here - not relevant for this
Loop
End If
The script executes the conditional but errors at the "Do Until" line, saying:
Microsoft VBScript runtime error '800a0009' Subscript out of range: '[number: 0]'
Now, why on Earth would this be giving an error if I'm testing the upper bound before checking it, and it's saying that the upper bound is at least 1?
I can post more of the code if I have to but I'd rather not since my predecessor was a complete hack and the code is extremely ugly.