Fix problem introduced in commit 4b4eeaad61

The NULL check was there before 4b4eeaad61