Skip to content

Commit 92e1546

Browse files
author
SlavaRa
committed
fixes: "Needs a try/catch to make sure the path is valid"
1 parent 5df06e8 commit 92e1546

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

External/Plugins/ProjectManager/PluginUI.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,19 @@ private void tree_AfterLabelEdit(Object sender, NodeLabelEditEventArgs e)
224224
string label = e.Label;
225225
int index = label.IndexOf(languageDisplayName);
226226
if (index != -1) label = label.Remove(index).Trim();
227-
var newName = Path.Combine(project.Directory, label);
228-
newName = Path.ChangeExtension(newName, Path.GetExtension(oldName));
227+
string newName = string.Empty;
228+
try
229+
{
230+
newName = Path.Combine(project.Directory, label);
231+
newName = Path.ChangeExtension(newName, Path.GetExtension(oldName));
232+
}
233+
catch (Exception exception)
234+
{
235+
e.CancelEdit = true;
236+
isEditingLabel = false;
237+
ErrorManager.ShowError(exception);
238+
return;
239+
}
229240
if (Rename(oldName, newName))
230241
{
231242
PluginBase.MainForm.OpenEditableDocument(newName);

0 commit comments

Comments
 (0)