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

[server] Fix NPE in ViewHierarchyAnalyzer #929

Merged
merged 1 commit into from Jun 30, 2015

Conversation

asm89
Copy link
Member

@asm89 asm89 commented Jun 30, 2015

Summary: We are seeing cases where we're querying native elements, but
there is no current activity. Previously this would result in a
NullPointerException in the ViewHierarchyAnalyzer. This changes
fixes the exception and adds a fallback when looking for resources:

  • added a check to see if the activity is null
  • if that's the case, try to get the resources from the passed view
  • before getting trying to get the resource name, check if the resources
    returned are non null (we've seen that case as well)

Test Plan: Ran our internal e2e tests against selendroid with this
patch.

Summary: We are seeing cases where we're querying native elements, but
there is no current activity. Previously this would result in a
`NullPointerException` in the `ViewHierarchyAnalyzer`. This changes
fixes the exception and adds a fallback when looking for resources:

- added a check to see if the activity is `null`
- if that's the case, try to get the resources from the passed view
- before getting trying to get the resource name, check if the resources
  returned are non null (we've seen that case as well)

Test Plan: Ran our internal e2e tests against selendroid with this
patch.
@lukeis
Copy link
Member

lukeis commented Jun 30, 2015

looks good to me, feel free to merge after travis comes back green

@asm89
Copy link
Member Author

asm89 commented Jun 30, 2015

More green! 🎉

asm89 added a commit that referenced this pull request Jun 30, 2015
[server] Fix NPE in ViewHierarchyAnalyzer
@asm89 asm89 merged commit 97e063c into selendroid:master Jun 30, 2015
@asm89 asm89 deleted the fix-npe-in-viewhierarchyanalyzer branch June 30, 2015 19:18
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.

None yet

2 participants