Should fix the case of idx = -1 being rightfully out of bounds. BUG: 447553
mentioned in commit 87aff4f4