fix: NPE in unused EcxHandler block removal code (#2086) #2104
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
In a comment to PR #2086 I tried to report a NPE in some cases, but I wasn't able to provide a stable plain java test case. Now I have an apk with the same issue.
Steps to reproduce:
android.support.v4.graphics.TypefaceCompatUtil.mmap(Context context, CancellationSignal cancellationSignal, Uri uri)
with latest git version:After adding a check for null the result looks better. Checking for null shouldn't be wrong, but this fix is probably incomplete, as this won't fix the root cause. Code caches need to be cleared to test this fix.
For
android.support.v4.graphics.TypefaceCompatUtil.mmap(File file)
it helped too, but compared to the latest release v1.4.7 there is still a regession. This method is very simple and the source code is known (https://android.googlesource.com/platform/frameworks/support/+/a9ac247af2afd4115c3eb6d16c05bc92737d6305/compat/src/main/java/androidx/core/graphics/TypefaceCompatUtil.java#81). Maybe this regression is fixable.