Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AndroidLeakFixes.kt #2712

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

GeorgCantor
Copy link

Streamlined Condition Checks:
The check for Application is unnecessary since if context is an instance of Application, it will not be an instance of Activity or ContextWrapper. Therefore, we only check for ContextWrapper in the loop.

Reduced Redundant Checks:
Instead of checking if baseContext is equal to this, we rely on the type checks. If we reach a point where context is neither an Activity nor a ContextWrapper, we can directly return null.

Simplified Return Logic:
After exiting the loop, a final check determines if the last context is an Activity, simplifying the return statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant