Fix crash in autocompletion #1270