Fix issue when selection is set without content

In some cases, you may have a selection set before the content it loaded. If
that happens things blow up. This checks to make sure we have content before
we try to operate on it.