Added checking to prevent null error in js

reviewer: tiff go (post commit)

Issue: gcp-8895