Added checking if datasetid is null

Reviewer: Tiff Go (post commit)

Issue: GCP-9919