Check null here as well

Fixes #1664