Null pointer check before using it

Change-Id: I6c7be0a049ccffdfd33cf72aa26006aa1636990f