react-native-view-shot
react-native-view-shot copied to clipboard
NullPointerException in applyTransformations
bug report
When using handleGLSurfaceViewOnAndroid: true there is a non-frequent bug that crashes our app.
This code in applyTransformations throws NullPointerException:
// find all parents of the child view
View iterator = child;
do {
ms.add(iterator);
iterator = (View) iterator.getParent(); // This line throws
} while (iterator != root);
My guess is that iterator == root on first iteration, because there is a special case in getAllChildren, where view is a children of itself:
@NonNull
private List<View> getAllChildren(@NonNull final View v) {
if (!(v instanceof ViewGroup)) {
final ArrayList<View> viewArrayList = new ArrayList<>();
viewArrayList.add(v);
return viewArrayList;
}
// ...
}
Version & Platform
[email protected] /Users/gavrilikhin_d/Code/chatroulette/app/mobile
├─┬ @react-native-async-storage/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-firebase/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-google-signin/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ ├─┬ @react-navigation/[email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @sentry/[email protected]
│ └── [email protected] deduped
├─┬ @stripe/[email protected]
│ └── [email protected] deduped
├─┬ @testing-library/[email protected]
│ └── [email protected] deduped
├─┬ @voximplant/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected] (git+ssh://[email protected]/react-native-webrtc/react-native-incall-manager.git#e66e99bc49c0ac859844a4d3f1b6214414c76d2a)
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├── [email protected]
└─┬ [email protected]
└── [email protected] deduped
Platform: Android
Expected behavior
No crash
Actual behavior
Crash
Steps to reproduce the behavior
Couldn't find a way to reproduce