Check if the Index value or Current object value is empty ?
you can change your Expression some thing like this
if $currentObject!=empty
then if $currentObject/index!=empty
then $currentObject/index mod 2 =0
and you can add your else statements accordingly.