Skip to content

Commit 92c73a2

Browse files
authored
Fix access error when subscripiton has no Tags property (#277)
Azure/azure-powershell#15425
1 parent b117855 commit 92c73a2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Authentication.Abstractions/Extensions/AzureSubscriptionExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ public static void SetSubscriptionPolicies(this IAzureSubscription subscription,
200200
/// <returns>The tags of the subscription</returns>
201201
public static Dictionary<string,string> GetTags(this IAzureSubscription subscription)
202202
{
203-
return JsonConvert.DeserializeObject<Dictionary<string,string>>(subscription.GetProperty(AzureSubscription.Property.Tags));
203+
var tags = subscription.GetProperty(AzureSubscription.Property.Tags);
204+
return string.IsNullOrEmpty(tags) ? null : JsonConvert.DeserializeObject<Dictionary<string,string>>(tags);
204205
}
205206

206207
/// <summary>

0 commit comments

Comments
 (0)