Add check for empty selection text - will cause exception otherwise.