Add null check
Merge pull request #1003 from kano4/pr-add-null-check

Add null check