Skip to content

Commit

Permalink
Merge pull request #4681 from drewnoakes/iteration
Browse files Browse the repository at this point in the history
Replace tail call recursion with loop
  • Loading branch information
drewnoakes committed Mar 28, 2018
2 parents f9d0c04 + 205855c commit 86c0f3e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
18 changes: 9 additions & 9 deletions GitUI/GitUIExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,16 +251,16 @@ public static void InvokeSync(this Control control, Action action)

public static Control FindFocusedControl(this ContainerControl container)
{
var control = container.ActiveControl;
container = control as ContainerControl;

if (container == null)
while (true)
{
return control;
}
else
{
return container.FindFocusedControl();
if (container.ActiveControl is ContainerControl activeContainer)
{
container = activeContainer;
}
else
{
return container.ActiveControl;
}
}
}
}
Expand Down
15 changes: 9 additions & 6 deletions GitUI/Plugin/LoadPlugins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,19 @@ public static void Load()
}
else
{
void GetEx(Exception arg)
// Walk inner exceptions
Exception e = ex;
while (true)
{
exceptionInfo += arg.Message + "\r\n";
if (arg.InnerException != null)
exceptionInfo += e.Message + "\r\n";

if (e.InnerException == null)
{
GetEx(arg.InnerException);
break;
}
}

GetEx(ex);
e = e.InnerException;
}
}

MessageBox.Show(string.Format("Failed to load plugin {0} : \r\n{1}", pluginFile, exceptionInfo));
Expand Down

0 comments on commit 86c0f3e

Please sign in to comment.