Skip to content

Commit

Permalink
Fix bugs on initial create and null exception.
Browse files Browse the repository at this point in the history
For the null exception, it's when the last tab gets closed and the
code tries to focus on ActiveDocument. Since it no longer exists, a
null pointer exception is thrown.

The second bug is on the creation of the first tab. It needs to be
focused after it is created.
  • Loading branch information
peaches committed May 19, 2012
1 parent c53c7af commit 3768bc9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions SuperPutty/frmSuperPutty.cs
Expand Up @@ -277,9 +277,16 @@ public bool IsActiveDocument(ctlPuttyPanel panel)
/// <param name="e"></param>
private void dockPanel1_ActiveDocumentChanged(object sender, EventArgs e)
{
FocusCurrentTab();
dockPanel1.ActiveDocument.TabTextColor = null;
dockPanel1.ActiveDocument.DockHandler.RefreshPaneChanges();
if (dockPanel1.ActiveDocument != null)
{
FocusCurrentTab();
dockPanel1.ActiveDocument.TabTextColor = null;
dockPanel1.ActiveDocument.DockHandler.RefreshPaneChanges();
}
else
{
this.Focus();
}
}

private void frmSuperPutty_Activated(object sender, EventArgs e)
Expand Down Expand Up @@ -447,7 +454,7 @@ public void CreatePuttyPanel(SessionData sessionData, bool isPutty)
this.BeginInvoke((MethodInvoker)delegate()
{
sessionPanel.Close();
});
});
}
else
{
Expand All @@ -458,6 +465,7 @@ public void CreatePuttyPanel(SessionData sessionData, bool isPutty)

sessionPanel = new ctlPuttyPanel(this, sessionData, callback, isPutty);
sessionPanel.Show(dockPanel1, sessionData.LastDockstate);
FocusCurrentTab();
}

private void newMintty_Click(object sender, EventArgs e)
Expand Down

0 comments on commit 3768bc9

Please sign in to comment.