add null check

Change-Id: Ia9de13f7ac05f55ed47a6b4ccf582c0b791a3c3b