Skip to content

Commit

Permalink
fix: Crash when suggest merge/diff tool paths
Browse files Browse the repository at this point in the history
If merge/diff tool paths enclosed in quotes, clicking on "Suggest" button
would crash the app.

Strip quotes from paths before attempting to suggest.

Fixes gitextensions#7000
  • Loading branch information
RussKie committed Aug 22, 2019
1 parent 6de714b commit 504c6a1
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,14 @@ private void MergeToolCmdSuggest_Click(object sender, EventArgs e)
return;
}

CurrentSettings.SetPathValue(string.Format("mergetool.{0}.path", _NO_TRANSLATE_GlobalMergeTool.Text.Trim()), MergetoolPath.Text?.Trim() ?? "");
var mergeToolPath = MergetoolPath.Text.Trim().Trim('"', '\'');

CurrentSettings.SetPathValue(string.Format("mergetool.{0}.path", _NO_TRANSLATE_GlobalMergeTool.Text.Trim()), mergeToolPath ?? "");
string exeName;
string exeFile;
if (!string.IsNullOrEmpty(MergetoolPath.Text))
if (!string.IsNullOrEmpty(mergeToolPath))
{
exeFile = MergetoolPath.Text;
exeFile = mergeToolPath;
exeName = Path.GetFileName(exeFile);
}
else
Expand Down Expand Up @@ -218,12 +220,14 @@ private void DiffToolCmdSuggest_Click(object sender, EventArgs e)
return;
}

CurrentSettings.SetPathValue(string.Format("difftool.{0}.path", _NO_TRANSLATE_GlobalDiffTool.Text.Trim()), DifftoolPath.Text?.Trim() ?? "");
var diffToolPath = DifftoolPath.Text.Trim().Trim('"', '\'');

CurrentSettings.SetPathValue(string.Format("difftool.{0}.path", _NO_TRANSLATE_GlobalDiffTool.Text.Trim()), diffToolPath ?? "");
string exeName;
string exeFile;
if (!string.IsNullOrEmpty(DifftoolPath.Text))
if (!string.IsNullOrEmpty(diffToolPath))
{
exeFile = DifftoolPath.Text;
exeFile = diffToolPath;
exeName = Path.GetFileName(exeFile);
}
else
Expand Down

0 comments on commit 504c6a1

Please sign in to comment.