Insert a safety check for null strings

This should be avoided by the data model implementation, but there seem
to be some issues with this under yet-to-be-identified conditions in the
JSON dumps.