Fix soft-crash on attempting to edit an empty item, and show an
error message instead.
Don't show a dialog if nothing is selected.