Skip to content

Conversation

@ashishkumar468
Copy link
Collaborator

  • Added null check for contribution with position in ContributionsListFragment

Description (required)

Fixes #3061 App Crashes in ContributionListFragment

What changes did you make and why?
Null checks on Contribution before extracting the uri's lastPathSegment
Tests performed (required)

Tested betaDebug on Pixel Api 27

* Added null check for contribution with position in ContributionsListFragment
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ A review job has been created and sent to the PullRequest network.


Check the status or cancel PullRequest code review here.

Copy link

@tests-checker tests-checker bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests to make sure this change works as expected?

@codecov-io
Copy link

Codecov Report

Merging #3062 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #3062      +/-   ##
=========================================
- Coverage    4.66%   4.66%   -0.01%     
=========================================
  Files         264     264              
  Lines       12359   12364       +5     
  Branches     1052    1054       +2     
=========================================
  Hits          577     577              
- Misses      11739   11744       +5     
  Partials       43      43
Impacted Files Coverage Δ
...mmons/contributions/ContributionsListFragment.java 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f605c5c...1b11666. Read the comment docs.

Copy link
Collaborator

@neslihanturan neslihanturan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ashishkumar468 for fast reply, it seems like it will prevent the NPE but do you think he cause of the NPE worth to solve? Or is it just an expected NPE?

@ashishkumar468
Copy link
Collaborator Author

@neslihanturan The NPE is happening because we are trying to fetch the id of the contribution from the cursor position and if the cursor gets closed somehow and we try to fetch the id then, null value will be returned, and that is why I have handled that. With the cursor based implementation, there are chances of the cursor getting closed when the app goes in background (Handled by the framework with the current implementation as far as I understand). An effect of this will be that in such cases, the position will not be retained on configuration changes.

@neslihanturan
Copy link
Collaborator

This should solve your reported issue @PavelAplevich

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PullRequest network review has been cancelled

You can reactivate the code review job from the PullRequest dashboard - or - by adding [pr] to the title of this code review.

@PavelAplevich
Copy link
Contributor

@neslihanturan @ashishkumar468 With this fix, app looks good. I think all works correctly

@misaochan
Copy link
Member

Thanks @ashishkumar468 and @PavelAplevich !

@misaochan misaochan merged commit 828b5a3 into commons-app:master Jul 10, 2019
@misaochan misaochan mentioned this pull request Jul 10, 2019
6 tasks
PavelAplevich pushed a commit to PavelAplevich/apps-android-commons that referenced this pull request Jul 10, 2019
* Added null check for contribution with position in ContributionsListFragment
PavelAplevich added a commit to PavelAplevich/apps-android-commons that referenced this pull request Jul 10, 2019
* Added null check for contribution with position in ContributionsListFragment
PavelAplevich added a commit to PavelAplevich/apps-android-commons that referenced this pull request Jul 10, 2019
@ashishkumar468 ashishkumar468 deleted the bugfix/contributionslist branch July 16, 2019 09:49
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.

App crashes in ContributionListFragment

5 participants