Revert "Missed null check may cause NPE"

This reverts commit 54735519943819e32df9aadcb81e9142f32e4cef.
Merge pull request #174 from GERey/master

Revert "Missed null check may cause NPE"