summaryrefslogtreecommitdiffstats
path: root/c++/src/H5Object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++/src/H5Object.cpp')
-rw-r--r--c++/src/H5Object.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 2d32014..2643e41 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -214,7 +214,7 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da
userData->object = this;
// call the C library routine H5Aiterate2 to iterate the attributes
- hsize_t idx = (hsize_t)*_idx;
+ hsize_t idx = _idx ? (hsize_t)*_idx : 0;
int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx,
userAttrOpWrpr, (void *) userData);
@@ -223,7 +223,8 @@ int H5Object::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_da
if( ret_value >= 0 ) {
/* Pass back update index value to calling code */
- *_idx = (unsigned)idx;
+ if (_idx)
+ *_idx = (unsigned)idx;
return( ret_value );
}