[Debugger] Check that the expression index is not -1

Fixes bug #9006