Skip to content

Commit

Permalink
Fixed a crash in pool name check.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextm committed Mar 23, 2019
1 parent be060bb commit f09c918
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions JexusManager.Shared/StringUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ namespace JexusManager
{
public static class StringUtility
{
public static string Combine(this IEnumerable<string> item, string connector)
public static string Combine<T>(this IEnumerable<T> item, string connector)
{
var preConditions = item.ToList();
if (preConditions.Count == 0)
{
return string.Empty;
}

var result = new StringBuilder(preConditions[0]);
var result = new StringBuilder(preConditions[0].ToString());
for (int index = 1; index < preConditions.Count; index++)
{
result.Append(connector).Append(preConditions[index]);
Expand Down
12 changes: 12 additions & 0 deletions JexusManager/Features/Main/ApplicationPoolBasicSettingsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,21 @@ public ApplicationPoolBasicSettingsDialog(IServiceProvider serviceProvider, Appl
{
ShowMessage("An application pool with this name already exists.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
txtName.Focus();
txtName.SelectAll();
return;
}
foreach (var ch in ApplicationPoolCollection.InvalidApplicationPoolNameCharacters())
{
if (txtName.Text.Contains(ch))
{
ShowMessage($"The application pool name cannot contain the following characters: {ApplicationPoolCollection.InvalidApplicationPoolNameCharacters().Combine(", ")}.", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
txtName.Focus();
txtName.SelectAll();
return;
}
}
Pool = collection.Add(txtName.Text);
}
else
Expand Down

0 comments on commit f09c918

Please sign in to comment.