added code to abort command if selection or current_word is nil or empty (was
resulting in an error before)