check for none type

Spotted an error in the console because this check was missing.