Added a check for a null pointer based on the bug fix documented in [NCF-340].
Added a check for a null pointer based on the bug fix documented in [NCF-340].

Unidata/netcdf-c,Unidata/netcdf-c,Unidata/netcdf-c,Unidata/netcdf-c