mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Cherry-Picked NPE fix from master (#4569)
This commit is contained in:
parent
6588a6fd0e
commit
bb3f8f3801
2 changed files with 10 additions and 6 deletions
|
|
@ -26,24 +26,28 @@ class PageContentsCreator {
|
|||
private final Context context;
|
||||
|
||||
@Inject
|
||||
public PageContentsCreator(Context context) {
|
||||
public PageContentsCreator(final Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public String createFrom(Contribution contribution, String countryCode) {
|
||||
public String createFrom(final Contribution contribution, final String countryCode) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
final Media media = contribution.getMedia();
|
||||
buffer
|
||||
.append("== {{int:filedesc}} ==\n")
|
||||
.append("{{Information\n")
|
||||
.append("|description=").append(media.getFallbackDescription())
|
||||
.append("{{ on Wikidata|").append(contribution.getWikidataPlace().getId()).append("}}")
|
||||
.append("|description=").append(media.getFallbackDescription()).append("\n");
|
||||
if (contribution.getWikidataPlace() != null) {
|
||||
buffer.append("{{ on Wikidata|").append(contribution.getWikidataPlace().getId())
|
||||
.append("}}");
|
||||
}
|
||||
buffer
|
||||
.append("\n")
|
||||
.append("|source=").append("{{own}}\n")
|
||||
.append("|author=[[User:").append(media.getAuthor()).append("|")
|
||||
.append(media.getAuthor()).append("]]\n");
|
||||
|
||||
String templatizedCreatedDate = getTemplatizedCreatedDate(
|
||||
final String templatizedCreatedDate = getTemplatizedCreatedDate(
|
||||
contribution.getDateCreated(), contribution.getDateCreatedSource());
|
||||
if (!StringUtils.isBlank(templatizedCreatedDate)) {
|
||||
buffer.append("|date=").append(templatizedCreatedDate);
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ class UploadWorker(var appContext: Context, workerParams: WorkerParameters) :
|
|||
//Upload the file from stash
|
||||
var countryCode: String? =null
|
||||
with(contribution.wikidataPlace?.location){
|
||||
if(contribution.wikidataPlace?.isMonumentUpload!!) {
|
||||
if (contribution.wikidataPlace?.isMonumentUpload == true) {
|
||||
countryCode =
|
||||
reverseGeoCode(contribution.wikidataPlace?.location!!)?.toLowerCase()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue