@@ -4157,13 +4157,21 @@ subroutine json_get_by_path(json, me, path, p, found)
4157
4157
! ! specify by `path`
4158
4158
logical (LK),intent (out ),optional :: found ! ! true if it was found
4159
4159
4160
- ! note: it can only be 1 or 2 (which was checked in initialize)
4161
- select case (json% path_mode)
4162
- case (1_IK )
4163
- call json% json_get_by_path_default(me, path, p, found)
4164
- case (2_IK )
4165
- call json% json_get_by_path_rfc6901(me, path, p, found)
4166
- end select
4160
+ nullify(p)
4161
+
4162
+ if (.not. json% exception_thrown) then
4163
+
4164
+ ! note: it can only be 1 or 2 (which was checked in initialize)
4165
+ select case (json% path_mode)
4166
+ case (1_IK )
4167
+ call json% json_get_by_path_default(me, path, p, found)
4168
+ case (2_IK )
4169
+ call json% json_get_by_path_rfc6901(me, path, p, found)
4170
+ end select
4171
+
4172
+ else
4173
+ if (present (found)) found = .false.
4174
+ end if
4167
4175
4168
4176
end subroutine json_get_by_path
4169
4177
! *****************************************************************************************
@@ -4200,23 +4208,30 @@ subroutine json_create_by_path(json,me,path,p,found,was_created)
4200
4208
4201
4209
if (present (p)) nullify(p)
4202
4210
4203
- ! note: path_mode can only be 1 or 2 (which was checked in initialize)
4204
- select case (json% path_mode)
4205
- case (1_IK )
4206
- call json% json_get_by_path_default(me,path,tmp,found,&
4207
- create_it= .true. ,&
4208
- was_created= was_created)
4209
- if (present (p)) p = > tmp
4210
- case (2_IK )
4211
- ! the problem here is there isn't really a way to disambiguate
4212
- ! the array elements, so '/a/0' could be 'a(1)' or 'a.0'.
4213
- call json% throw_exception(' Create by path not supported in RFC 6901 path mode.' )
4214
- if (present (found)) then
4215
- call json% clear_exceptions()
4216
- found = .false.
4217
- end if
4211
+ if (.not. json% exception_thrown) then
4212
+
4213
+ ! note: path_mode can only be 1 or 2 (which was checked in initialize)
4214
+ select case (json% path_mode)
4215
+ case (1_IK )
4216
+ call json% json_get_by_path_default(me,path,tmp,found,&
4217
+ create_it= .true. ,&
4218
+ was_created= was_created)
4219
+ if (present (p)) p = > tmp
4220
+ case (2_IK )
4221
+ ! the problem here is there isn't really a way to disambiguate
4222
+ ! the array elements, so '/a/0' could be 'a(1)' or 'a.0'.
4223
+ call json% throw_exception(' Create by path not supported in RFC 6901 path mode.' )
4224
+ if (present (found)) then
4225
+ call json% clear_exceptions()
4226
+ found = .false.
4227
+ end if
4228
+ if (present (was_created)) was_created = .false.
4229
+ end select
4230
+
4231
+ else
4218
4232
if (present (was_created)) was_created = .false.
4219
- end select
4233
+ if (present (found)) found = .false.
4234
+ end if
4220
4235
4221
4236
end subroutine json_create_by_path
4222
4237
! *****************************************************************************************
0 commit comments