Fixes a crash when entering ' as search text.