Fix possible crash(es) related to find-in-page.

https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketID=7639068

Change-Id: Iad5184119d1a6174790bd6a6e983842b0daef82e