Skip to content
This repository has been archived by the owner on Nov 8, 2020. It is now read-only.

Commit

Permalink
Fix a potential null pointer
Browse files Browse the repository at this point in the history
Apparently sometimes the tab that is being selected or deselected
doesn’t exist.
  • Loading branch information
savagerose committed May 18, 2015
1 parent b192b60 commit 33d8774
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions TabController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void OnDeselect(object sender, TabControlCancelEventArgs args)
}
else if (Platform.IsMac)
{
if (args.Action == TabControlAction.Deselecting)
if (args.Action == TabControlAction.Deselecting && args.TabPage != null)
{
// Have to set visibility to false on children controls on hidden tabs because they don't
// always heed parent visibility on Mac OS X https://bugzilla.xamarin.com/show_bug.cgi?id=3124
Expand All @@ -149,7 +149,7 @@ private void OnDeselect(object sender, TabControlCancelEventArgs args)
control.Visible = false;
}
}
else if (args.Action == TabControlAction.Selecting)
else if (args.Action == TabControlAction.Selecting && args.TabPage != null)
{
// Set children controls' visibility back to true
foreach (Control control in args.TabPage.Controls)
Expand Down

0 comments on commit 33d8774

Please sign in to comment.