Added nullpointer check when saving

Reviewer: Chezka Arevalo

Issue: GCP-9125