summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5B2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/H5B2.c b/src/H5B2.c
index a1fdaa1..48385a3 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -3328,7 +3328,8 @@ H5B2_remove_leaf(H5F_t *f, hid_t dxpl_id, H5RC_t *bt2_shared,
if(leaf->nrec > 0) {
/* Pack record out of leaf */
- HDmemmove(H5B2_LEAF_NREC(leaf,shared,idx),H5B2_LEAF_NREC(leaf,shared,idx+1),shared->type->nrec_size*(leaf->nrec-idx));
+ if(idx<leaf->nrec)
+ HDmemmove(H5B2_LEAF_NREC(leaf,shared,idx),H5B2_LEAF_NREC(leaf,shared,idx+1),shared->type->nrec_size*(leaf->nrec-idx));
} /* end if */
else {
/* Release space for B-tree node on disk */