Skip to content

Commit 9fb0178

Browse files
committed
Fix crash with invalid parent activity
1 parent f96007e commit 9fb0178

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

MvvmCross.Droid.Support.V4/MvxFragmentStatePagerAdapter2.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Java.Lang;
1111
using String = Java.Lang.String;
1212
using MvvmCross.Droid.Shared.Attributes;
13+
using MvvmCross.Platform.Droid.Platform;
1314

1415
namespace MvvmCross.Droid.Support.V4
1516
{
@@ -52,7 +53,7 @@ public override Fragment GetItem(int position, Fragment.SavedState fragmentSaved
5253
if (mvxFragment == null)
5354
return fragment;
5455

55-
if (mvxFragment.GetType().IsFragmentCacheable(fragment.Activity.GetType()) && fragmentSavedState != null)
56+
if (mvxFragment.GetType().IsFragmentCacheable(Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity.GetType()) && fragmentSavedState != null)
5657
return fragment;
5758

5859
var viewModel = CreateViewModel(position);

0 commit comments

Comments
 (0)