Bug fix: selectedRow is -1 when tableview has no selection.