Added null check to avoid null pointer issue

Reviewer: Tiff Go

Issue: GCp-9863