summaryrefslogtreecommitdiffstats
path: root/src/H5T.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5T.c')
-rw-r--r--src/H5T.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/H5T.c b/src/H5T.c
index 07bc062..11eef4b 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -3284,6 +3284,7 @@ H5Tconvert (hid_t src_id, hid_t dst_id, size_t nelmts, void *buf,
H5T_cdata_t *cdata = NULL; /*conversion data */
H5T_conv_t tconv_func = NULL; /*conversion function */
herr_t status; /*func return status */
+ H5T_t *src=NULL, *dst=NULL; /*unatomized types */
#ifdef H5T_DEBUG
H5_timer_t timer; /*conversion timer */
#endif
@@ -3291,7 +3292,16 @@ H5Tconvert (hid_t src_id, hid_t dst_id, size_t nelmts, void *buf,
FUNC_ENTER (H5Tconvert, FAIL);
H5TRACE5("e","iizxx",src_id,dst_id,nelmts,buf,background);
- if (NULL==(tconv_func=H5Tfind (src_id, dst_id, &cdata))) {
+ /* Check args */
+ if (H5_DATATYPE!=H5I_group(src_id) ||
+ NULL==(src=H5I_object(src_id)) ||
+ H5_DATATYPE!=H5I_group(dst_id) ||
+ NULL==(dst=H5I_object(dst_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type");
+ }
+
+ /* Find the conversion function */
+ if (NULL==(tconv_func=H5T_find (src, dst, H5T_BKG_NO, &cdata))) {
HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to convert between src and dst data types");
}