Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit 1cd21d2

Browse files
committed
improve file rename logic
1 parent 0b1f402 commit 1cd21d2

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

UI/Windows/RenameWindow.xaml.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ private bool IsNameTaken(string inputText)
110110

111111
private void CheckExtension()
112112
{
113-
try
114-
{
115-
if (!Program.MainWindow.FileIcons.ContainsKey(TxtName.Text.Substring(TxtName.Text.LastIndexOf('.'))))
113+
if (!TxtName.Text.Contains(".") || !Program.MainWindow.FileIcons.ContainsKey(TxtName.Text.Substring(TxtName.Text.LastIndexOf('.'))))
116114
{
117115
lblError.Content = Program.Translations.GetLanguage("FileNotSupported");
118116
lblError.ToolTip = Program.Translations.GetLanguage("FileWillBeExcluded");
@@ -122,11 +120,6 @@ private void CheckExtension()
122120
lblError.Content = "";
123121
lblError.ToolTip = "";
124122
}
125-
}
126-
catch (ArgumentOutOfRangeException)
127-
{
128-
// this is ugly and newbish but I'm lazy and it works
129-
}
130123
}
131124

132125
public void Language_Translate()

0 commit comments

Comments
 (0)