[Debugger] Make sure the selection is non-empty before trying to get the selected row

Fixes bug #20008