diff --git a/opal/mca/dstore/base/dstore_base_stubs.c b/opal/mca/dstore/base/dstore_base_stubs.c index 2040f31d83..140b89ce41 100644 --- a/opal/mca/dstore/base/dstore_base_stubs.c +++ b/opal/mca/dstore/base/dstore_base_stubs.c @@ -83,6 +83,10 @@ int opal_dstore_base_store(int dstorehandle, { opal_dstore_handle_t *hdl; + if (dstorehandle < 0) { + return OPAL_ERR_NOT_INITIALIZED; + } + if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) { OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); return OPAL_ERR_NOT_FOUND; @@ -99,6 +103,11 @@ void opal_dstore_base_commit(int dstorehandle, { opal_dstore_handle_t *hdl; + if (dstorehandle < 0) { + OPAL_ERROR_LOG(OPAL_ERR_NOT_INITIALIZED); + return; + } + if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) { OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); return; @@ -119,6 +128,10 @@ int opal_dstore_base_fetch(int dstorehandle, { opal_dstore_handle_t *hdl; + if (dstorehandle < 0) { + return OPAL_ERR_NOT_INITIALIZED; + } + if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) { OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); return OPAL_ERR_NOT_FOUND; @@ -136,6 +149,10 @@ int opal_dstore_base_remove_data(int dstorehandle, { opal_dstore_handle_t *hdl; + if (dstorehandle < 0) { + return OPAL_ERR_NOT_INITIALIZED; + } + if (NULL == (hdl = (opal_dstore_handle_t*)opal_pointer_array_get_item(&opal_dstore_base.handles, dstorehandle))) { OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); return OPAL_ERR_NOT_FOUND;