Ensure that the variable candidate is referenced 
before assignment
Merge pull request #8126 from dknecht/develop

Ensure that the variable candidate is referenced