Null dereference check

Fixes a static analyzer warning.