Added validation to ensure we avoid null pointer exception

Reviewer: Chika Arevalo

Issue: none