File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,9 @@ public async Task<bool> DeleteRecordAsync(string recordName)
6767 var json = await recordsResp . Content . ReadAsStringAsync ( ) ;
6868 var doc = JsonDocument . Parse ( json ) ;
6969
70- var recordId = doc . RootElement . GetProperty ( "result" ) . EnumerateArray ( )
71- . FirstOrDefault ( ) . GetProperty ( "id" ) . GetString ( ) ;
70+ var resultArray = doc . RootElement . GetProperty ( "result" ) ;
71+ if ( resultArray . GetArrayLength ( ) == 0 ) return false ;
72+ var recordId = resultArray [ 0 ] . GetProperty ( "id" ) . GetString ( ) ;
7273
7374 if ( recordId == null ) return false ;
7475
@@ -86,9 +87,9 @@ public async Task<bool> DeleteRecordAsync(string recordName)
8687
8788 var json = await response . Content . ReadAsStringAsync ( ) ;
8889 var doc = JsonDocument . Parse ( json ) ;
89- var results = doc . RootElement . GetProperty ( "result" ) . EnumerateArray ( ) ;
90- if ( ! results . Any ( ) ) return null ;
91- return results . First ( ) . GetProperty ( "id" ) . GetString ( ) ;
90+ var resultArray = doc . RootElement . GetProperty ( "result" ) ;
91+ if ( resultArray . GetArrayLength ( ) == 0 ) return null ;
92+ return resultArray [ 0 ] . GetProperty ( "id" ) . GetString ( ) ;
9293 }
9394
9495 private async Task < ( string ? zoneName , string ? zoneId ) > FindZoneForRecordAsync ( string recordName )
You can’t perform that action at this time.
0 commit comments