Added an assert.

Check why sometimes controller has a null goal.