I think there's probably a bug here. Above, you check if leftResult != -1, then you assume it's an array on these two lines.