Fix wikitext warning: Get range from selection before trying to find start

Bug: 72475
Change-Id: Ib43d9c6b9b46be461354b3b5bbdf9d5de90887a6
Merge "Fix wikitext warning: Get range from selection before trying to find start"