core.completion: fix nil-related bug