break infinite loop

endOfScript() can return -1 , which will never be >= maText.getLength(),
and nothing will update once nChg is that way. It originally worked
when nChg was unsigned, but 44fbecbfe297cefcc844ca2071fbf017777dd4c3
changed that and missed it (no wonder, given even the explicit cast,
which was stupid, so possibly there is a problem elsewhere, but this
way it at least doesn't lock up).

Change-Id: Ia5138ba36916bd0bfb8f07854580c39d2622f201