Fix a crash when generating the autocomplete suggestions