From 48d70c704d5e460f2d34b05770c4b753219b0bed Mon Sep 17 00:00:00 2001 From: Ignacio Garcia Date: Thu, 21 Nov 2019 20:12:56 +0100 Subject: [PATCH] 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. (#3212) * Deleted values-tt-cryl since it was causing an error and could not build the app. * 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. I just check if the list is empty, and in that case I add a new Description to the list. * Revert "Deleted values-tt-cryl since it was causing an error and could not build the app." This reverts commit b0f4392a I reverted deleting the folder. --- app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java b/app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java index e1cefc2d0..1ca5c2be0 100644 --- a/app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java +++ b/app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java @@ -142,6 +142,9 @@ public class UploadModel { createdTimestampSource); if (place != null) { uploadItem.title.setTitleText(place.name); + if(uploadItem.descriptions.isEmpty()) { + uploadItem.descriptions.add(new Description()); + } uploadItem.descriptions.get(0).setDescriptionText(place.getLongDescription()); uploadItem.descriptions.get(0).setLanguageCode("en"); }