- if (!array_obj || !bt_value_is_array(array_obj) || !element_obj ||
- index >= typed_array_obj->garray->len) {
+ if (!array_obj || !element_obj) {
+ BT_LOGW("Invalid parameter: array value or element value is NULL: "
+ "index=%" PRIu64 ", array-value-addr=%p, element-value-addr=%p",
+ index, array_obj, element_obj);
+ ret = BT_VALUE_STATUS_INVAL;
+ goto end;
+ }
+
+ if (!bt_value_is_array(array_obj)) {
+ BT_LOGW("Invalid parameter: value is not an array value: addr=%p, "
+ "type=%s", array_obj,
+ bt_value_type_string(array_obj->type));
+ ret = BT_VALUE_STATUS_INVAL;
+ goto end;
+ }
+
+ if (index >= typed_array_obj->garray->len) {
+ BT_LOGW("Invalid parameter: index is out of bounds: "
+ "addr=%p, index=%" PRIu64 ", size=%u",
+ array_obj, index, typed_array_obj->garray->len);