[Ide] Fixed a possible index out of range exception.