Skip to content

Commit a88100c

Browse files
committed
Fix: Wrong behaviour if null
1 parent db0d084 commit a88100c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Source/NETworkManager.Profiles/ProfileManager.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,10 +1084,18 @@ public static bool GroupExists(string name)
10841084
/// </summary>
10851085
/// <param name="name">Name of the group</param>
10861086
/// <returns>True if the group has no profiles.</returns>
1087+
/// <exception cref="ArgumentException">Thrown when name is null or empty.</exception>
1088+
/// <exception cref="InvalidOperationException">Thrown when group with specified name is not found.</exception>
10871089
public static bool IsGroupEmpty(string name)
10881090
{
1091+
ArgumentException.ThrowIfNullOrWhiteSpace(name);
1092+
10891093
var group = LoadedProfileFileData.Groups.FirstOrDefault(x => x.Name == name);
1090-
return group?.Profiles.Count == 0;
1094+
1095+
if (group == null)
1096+
throw new InvalidOperationException($"Group '{name}' not found.");
1097+
1098+
return group.Profiles.Count == 0;
10911099
}
10921100

10931101
#endregion

0 commit comments

Comments
 (0)