fix a crash when lastline.length = 0