diff --git a/android/src/main/java/com/cmcewen/blurview/BlurViewManager.java b/android/src/main/java/com/cmcewen/blurview/BlurViewManager.java index 24be33e..9090d33 100644 --- a/android/src/main/java/com/cmcewen/blurview/BlurViewManager.java +++ b/android/src/main/java/com/cmcewen/blurview/BlurViewManager.java @@ -50,10 +50,12 @@ public class BlurViewManager extends SimpleViewManager { @ReactProp(name = "viewRef") public void setViewRef(BlurringView view, int viewRef) { - View viewToBlur = context.getCurrentActivity().findViewById(viewRef); + if (context != null && context.getCurrentActivity() != null) { + View viewToBlur = context.getCurrentActivity().findViewById(viewRef); - if (viewToBlur != null) { - view.setBlurredView(viewToBlur); + if (viewToBlur != null) { + view.setBlurredView(viewToBlur); + } } } }