Fix potential OutOfBoundsException in PositionProvider
Created by: romac
In a standalone version of PosititionProvider, scalac complains at this line that comparing values of types Unit and Int using '!=' will always yield true
, which indeed turns out to be problematic as it might yield a OutOfBoundsException
(eg. when given a StringReader
). In this fix, I have also wrapped the supplied reader with a BufferedReader
just in case the given reader was not already buffered.