Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 0285677

Browse files
Cfun1TheCodeTravelerjsuarezruizjfversluis
authored
Add some null checks (#1033)
Co-authored-by: Brandon Minnick <[email protected]> Co-authored-by: Javier Suárez <[email protected]> Co-authored-by: Gerald Versluis <[email protected]>
1 parent b15c187 commit 0285677

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

src/CommunityToolkit/Xamarin.CommunityToolkit/Views/TabView/TabView.shared.cs

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -958,11 +958,27 @@ void UpdateIsTabStripVisible(bool isTabStripVisible)
958958

959959
void UpdateTabContentHeight(double tabContentHeight) => contentContainer.HeightRequest = tabContentHeight;
960960

961-
void UpdateTabIndicatorColor(Color tabIndicatorColor) => tabStripIndicator.BackgroundColor = tabIndicatorColor;
961+
void UpdateTabIndicatorColor(Color tabIndicatorColor)
962+
{
963+
if (tabStripIndicator != null)
964+
tabStripIndicator.BackgroundColor = tabIndicatorColor;
965+
}
962966

963-
void UpdateTabIndicatorHeight(double tabIndicatorHeight) => tabStripIndicator.HeightRequest = tabIndicatorHeight;
967+
void UpdateTabIndicatorHeight(double tabIndicatorHeight)
968+
{
969+
if (tabStripIndicator != null)
970+
{
971+
tabStripIndicator.HeightRequest = tabIndicatorHeight;
972+
}
973+
}
964974

965-
void UpdateTabIndicatorWidth(double tabIndicatorWidth) => tabStripIndicator.WidthRequest = tabIndicatorWidth;
975+
void UpdateTabIndicatorWidth(double tabIndicatorWidth)
976+
{
977+
if (tabStripIndicator != null)
978+
{
979+
tabStripIndicator.WidthRequest = tabIndicatorWidth;
980+
}
981+
}
966982

967983
void UpdateTabIndicatorView(View tabIndicatorView)
968984
{
@@ -991,9 +1007,21 @@ void UpdateTabIndicatorPlacement(TabIndicatorPlacement tabIndicatorPlacement)
9911007
UpdateTabIndicatorMargin();
9921008
}
9931009

994-
void UpdateIsSwipeEnabled(bool isSwipeEnabled) => contentContainer.IsSwipeEnabled = isSwipeEnabled;
1010+
void UpdateIsSwipeEnabled(bool isSwipeEnabled)
1011+
{
1012+
if (contentContainer != null)
1013+
{
1014+
contentContainer.IsSwipeEnabled = isSwipeEnabled;
1015+
}
1016+
}
9951017

996-
void UpdateIsTabTransitionEnabled(bool isTabTransitionEnabled) => contentContainer.IsScrollAnimated = isTabTransitionEnabled;
1018+
void UpdateIsTabTransitionEnabled(bool isTabTransitionEnabled)
1019+
{
1020+
if (contentContainer != null)
1021+
{
1022+
contentContainer.IsScrollAnimated = isTabTransitionEnabled;
1023+
}
1024+
}
9971025

9981026
void UpdateTabIndicatorPosition(int tabViewItemIndex)
9991027
{

0 commit comments

Comments
 (0)