[Solved] Index out of bounds in an if statement [closed]

[ad_1]

Presumably rhs is empty, and so rhs[0] does not exist. Hence an index out of bounds exception is thrown.

Try

if(!String.IsNullOrEmpty(rhs) && rhs[0] == '+')
... 

3

[ad_2]

solved Index out of bounds in an if statement [closed]