Move assert to after NULL check, otherwise we deref NULL in the assert.
Move assert to after NULL check, otherwise we deref NULL in the assert.

Klocwork #307

sk-/python2.7-type-annotator,sk-/python2.7-type-annotator,sk-/python2.7-type-annotator