Add error checking for selected row.