Skip to content

Commit c888a95

Browse files
committed
add error handling for tags being null to return default cmdlets, cmds, dscresource arrays so default ResourceIncludes is created
1 parent 8517684 commit c888a95

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

src/code/PSResourceInfo.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ public static bool TryConvertFromContainerRegistryJson(
10821082
{ "NormalizedVersion", metadata["NormalizedVersion"].ToString() }
10831083
};
10841084

1085-
var typeInfo = ParseHttpMetadataType(metadata["Tags"] as string[], out ArrayList commandNames, out ArrayList cmdletNames, out ArrayList dscResourceNames);
1085+
ParseHttpMetadataType(metadata["Tags"] as string[], out ArrayList commandNames, out ArrayList cmdletNames, out ArrayList dscResourceNames);
10861086
var resourceHashtable = new Hashtable {
10871087
{ nameof(PSResourceInfo.Includes.Command), new PSObject(commandNames) },
10881088
{ nameof(PSResourceInfo.Includes.Cmdlet), new PSObject(cmdletNames) },
@@ -1708,16 +1708,22 @@ private static ResourceType ParseHttpMetadataType(
17081708
out ArrayList dscResourceNames)
17091709
{
17101710
// possible type combinations:
1711-
// M, C
1712-
// M, D
1713-
// M
1714-
// S
1711+
// M, C
1712+
// M, D
1713+
// M
1714+
// S
17151715

17161716
commandNames = new ArrayList();
17171717
cmdletNames = new ArrayList();
17181718
dscResourceNames = new ArrayList();
17191719

17201720
ResourceType pkgType = ResourceType.Module;
1721+
1722+
if (tags == null)
1723+
{
1724+
return pkgType;
1725+
}
1726+
17211727
foreach (string tag in tags)
17221728
{
17231729
if (String.Equals(tag, "PSScript", StringComparison.InvariantCultureIgnoreCase))

0 commit comments

Comments
 (0)