Fixes a NullPointerException that crashes the app (#236)

* Fix NullPointerException

* Fix syntax error
This commit is contained in:
Chintan Parikh 2017-11-09 04:11:38 -08:00 committed by Alexey
parent 734ac38f62
commit aca380cee5
1 changed files with 5 additions and 3 deletions

View File

@ -50,10 +50,12 @@ public class BlurViewManager extends SimpleViewManager<BlurringView> {
@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);
}
}
}
}