Fixes NoneType error.

Sometimes result is None, i.e. not a Candidate instance.

Fixes: https://github.com/Tribler/tribler/issues/151