commit | 82810e7d1bc710e47813a3efc854a6ce186f4cf6 | [log] [tgz] |
---|---|---|
author | Josep del Río <[email protected]> | Fri Nov 04 21:40:02 2022 +0000 |
committer | Josep del Río <[email protected]> | Fri Nov 04 21:40:02 2022 +0000 |
tree | b729653dd4a80cb61fe9a1c4841ee5a7d3f251f3 | |
parent | 0a3584b53d9aaf9d17976b7bf1056a5142aae8ae [diff] |
Fix null pointer exception in prediction API when using multitouch For handling partial failures, the precition library would free the resources and return null; however, it was not checked whether the resource existed before recycling it, which caused null pointer exceptions. Test: manual Bug: 256228049 Change-Id: I017149f26d415edac4797be2a87764fbe73481f5
diff --git a/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java b/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java index c517321..1b0b3cd 100644 --- a/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java +++ b/input/input-motionprediction/src/main/java/androidx/input/motionprediction/kalman/MultiPointerPredictor.java
@@ -161,7 +161,9 @@ if (foundNullPrediction) { for (MotionEvent ev : singlePointerEvents) { - ev.recycle(); + if (ev != null) { + ev.recycle(); + } } return null; }