mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-06 18:00:24 +08:00
Added a check for a null pointer based on the bug fix documented in [NCF-340].
This commit is contained in:
parent
dffaff8406
commit
8c70437580
18
libsrc/var.c
18
libsrc/var.c
@ -523,22 +523,20 @@ NC_check_vlen(NC_var *varp, size_t vlen_max) {
|
||||
|
||||
int NC_lookupvar(NC3_INFO* ncp, int varid, NC_var **varp)
|
||||
{
|
||||
if(varid == NC_GLOBAL)
|
||||
if(varid == NC_GLOBAL)
|
||||
{
|
||||
/* Global is error in this context */
|
||||
/* Global is error in this context */
|
||||
return NC_EGLOBAL;
|
||||
}
|
||||
|
||||
*varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
if(varp == NULL)
|
||||
{
|
||||
return NC_ENOTVAR;
|
||||
}
|
||||
|
||||
return NC_NOERR;
|
||||
|
||||
*varp = elem_NC_vararray(&ncp->vars, (size_t)varid);
|
||||
|
||||
if(varp == NULL)
|
||||
return NC_ENOTVAR;
|
||||
if(*varp == NULL)
|
||||
return NC_ENOTVAR;
|
||||
|
||||
return NC_NOERR;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user