Skip to content

Commit bd506bc

Browse files
committed
fix(android): crash on snackbar in background
1 parent 96c222d commit bd506bc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/snackbar/snackbar.android.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ export class SnackBar extends SnackBarBase {
150150
}
151151
(cb as any).nListener = null;
152152
if (nCoordinatorLayout) {
153-
(nCoordinatorLayout.getParent() as android.view.ViewGroup).removeView(nCoordinatorLayout);
153+
const parent = nCoordinatorLayout.getParent() as android.view.ViewGroup;
154+
// in case of the view being in background the parent might already be null
155+
if (parent) {
156+
parent.removeView(nCoordinatorLayout);
157+
}
154158
(page as any).nCoordinatorLayout = null;
155159
}
156160
},

0 commit comments

Comments
 (0)