in some cases, there's no selection

Need to protect against no selection in the browser.