Skip to content

Conversation

@IgnacioGarcia198
Copy link
Contributor

Description (required)
Fix for issue #3210: When the place is not null but the descriptions list is empty there was a crash on getting the first element of the Descriptions list.

Fixes #3210 Crash when uploading a picture via Nearby

What changes did you make and why?
I just check if the list is empty, and in that case I add a new Description to the list.

Tests performed (required)

Tested betaDebug on Asus ASUS_X00ID with API level 25
Screenshot_20191119-194317
.

Screenshots showing what changed (optional - for UI changes)

Need help? See https://support.google.com/android/answer/9075928


Note: Please ensure that you have read CONTRIBUTING.md if this is your first pull request.

…scriptions list is empty there was a crash on getting the first element of the Descriptions list. I just check if the list is empty, and in that case I add a new Description to the list.
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

❗ No coverage uploaded for pull request base (master@f786598). Click here to learn what that means.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #3212   +/-   ##
========================================
  Coverage          ?   5.96%           
========================================
  Files             ?     260           
  Lines             ?   11175           
  Branches          ?     851           
========================================
  Hits              ?     667           
  Misses            ?   10452           
  Partials          ?      56
Impacted Files Coverage Δ
...n/java/fr/free/nrw/commons/upload/UploadModel.java 23.74% <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 f786598...861a04b. Read the comment docs.

…d not build the app."

This reverts commit b0f4392
I reverted deleting the folder.
@neslihanturan neslihanturan changed the title Fixing#3210 Fixing#3210 When the place is not null but the descriptions list is empty there was a crash on getting the first element of the Descriptions list. Nov 21, 2019
@neslihanturan
Copy link
Collaborator

Hey @IgnacioGarcia198 , the form of the PR is perfect. But I need to investigate more to understand if it s safe to create e new description instead of looking for root cause.

@IgnacioGarcia198
Copy link
Contributor Author

@neslihanturan I totally agree. I thought this pull request or this idea can help a little bit in debugging in order to see if the cause is that the photos cannot be saved or those places just did not have any photos yet, etc.

@maskaravivek
Copy link
Contributor

@neslihanturan It seems this fix is the right way to fix the issue. In UploadModel the expectation is that at least 1 description item would be present. See code:

            uploadItem.descriptions.get(0).setDescriptionText(place.getLongDescription());
            uploadItem.descriptions.get(0).setLanguageCode("en");

As I am currently trying to test #3213, I need this fix in master. So going ahead and merging the fix. We can probably keep issue #3210 open until we are sure that is the right way to fix it. :)

@maskaravivek maskaravivek merged commit 48d70c7 into commons-app:master Nov 21, 2019
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.

Crash when uploading a picture via Nearby

4 participants