Added null check
Merge pull request #197 from sarality/NullCheck

Added null check