MPDP-8274 | Add null check to finger count change #141
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This MR addresses a potential crash in CVFloatingZoomView related to null pointer exceptions involving lastCenter and initialPoint during multi-touch interactions. Although I was unable to reproduce the crash locally, analysis of the crash logs and code indicates that a rapid change in finger count or an interrupted initialization sequence could result in these variables being null when accessed, leading to a crash.
To mitigate this, I have added null checks before performing operations on these variables in the relevant methods. This ensures that, even in rare edge cases, the app will not crash and the zoom view will continue to provide a seamless user experience. Since the zoom functionality already works smoothly for typical usage, this is a defensive fix to cover unexpected scenarios.