optimized by replacing a function reference with direct syntax
Merge pull request #2071 from and-ers/master

Optimized null check