Fixes NoneType error.

Sometimes result is None, i.e. not a Candidate instance.