Meorge/SwiftInk

Range error in for-loop of StoryState.trimWhitespaceFromFunctionEnd()

Opened this issue · 1 comments

outputStream.count == 1, but outputStream.count - 1 == 0, thus resulting in a range error where the starting value is 1 and the ending value of the range is 0.
See line 1074

Repro:
In Ink story, use a function in your story, call it via a choice and watch the values of functionStartPoint and outputStream.count equal each other, resulting in a) range error after outputStream.count - 1 or b) index out of range error on next line (hit by removing the minus one operation on outputStream.count).

I have tried to identify where the whitespace is in the ink file that is causing this method to be called, yet, I have been unable to, despite removing all whitespaces in the function signature and as many whitespaces as I can in the Ink file in general. Still, no avail.