Fix a null pointer exception that crashes the app

Change-Id: I8286769f2bb72059ed90c7f49edf22c7c4927dc8