Skip to content

Commit 858c4db

Browse files
alericksonanamnavi
authored andcommitted
Fix two minor bugs w/reading V3 server responses (PowerShell#991)
1 parent e93eb27 commit 858c4db

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/code/V3ServerAPICalls.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,10 @@ private Hashtable FindResourceType(string[] resourceTypeName, out ExceptionDispa
592592
{
593593
Hashtable resourceHash = new Hashtable();
594594
JsonElement[] resources = GetJsonElementArr($"{repository.Uri}", resourcesName, out edi);
595+
if (edi != null)
596+
{
597+
return resourceHash;
598+
}
595599

596600
foreach (JsonElement resource in resources)
597601
{
@@ -654,7 +658,7 @@ private string FindVersionHelper(string registrationsBaseUrl, string packageName
654658
JsonDocument pkgMappingDom = JsonDocument.Parse(pkgMappingResponse);
655659
JsonElement rootPkgMappingDom = pkgMappingDom.RootElement;
656660

657-
if (!rootPkgMappingDom.TryGetProperty("catalogEntry", out JsonElement catalogEntryUrlElement) || String.IsNullOrEmpty(catalogEntryUrl))
661+
if (!rootPkgMappingDom.TryGetProperty("catalogEntry", out JsonElement catalogEntryUrlElement))
658662
{
659663
string errMsg = $"FindVersionHelper(): CatalogEntry element could not be found in response or was empty.";
660664
edi = ExceptionDispatchInfo.Capture(new JsonParsingException(errMsg));

0 commit comments

Comments
 (0)