diff --git a/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c b/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c index 00b991927d..1f111503f2 100644 --- a/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c +++ b/packages/seacas/libraries/exodus/src/ex_put_partial_num_map.c @@ -159,7 +159,11 @@ int ex_put_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_ } /* Check input parameters for a valid range of numbers */ - if (ent_start <= 0 || ent_start > num_mobj) { + if (ent_count == 0) { + ent_start = 0; + } + + if (ent_start < 0 || ent_start > num_mobj) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start count is invalid in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); EX_FUNC_LEAVE(EX_FATAL); @@ -169,7 +173,7 @@ int ex_put_partial_num_map(int exoid, ex_entity_type map_type, ex_entity_id map_ ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM); EX_FUNC_LEAVE(EX_FATAL); } - if (ent_start + ent_count - 1 > num_mobj) { + if (ent_count > 0 && (ent_start + ent_count - 1 > num_mobj)) { snprintf(errmsg, MAX_ERR_LENGTH, "ERROR: start+count-1 is larger than mesh object count in file id %d", exoid); ex_err_fn(exoid, __func__, errmsg, EX_BADPARAM);