mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Fix NPE with UploadMediaDetails.captionText (#6128)
Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
76078cf3b5
commit
62136b5b09
5 changed files with 7 additions and 7 deletions
|
|
@ -101,7 +101,7 @@ data class Contribution constructor(
|
|||
*/
|
||||
fun formatCaptions(uploadMediaDetails: List<UploadMediaDetail>) =
|
||||
uploadMediaDetails
|
||||
.associate { it.languageCode!! to it.captionText!! }
|
||||
.associate { it.languageCode!! to it.captionText }
|
||||
.filter { it.value.isNotBlank() }
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -267,11 +267,11 @@ class DescriptionEditActivity :
|
|||
applicationContext,
|
||||
media,
|
||||
mediaDetail.languageCode!!,
|
||||
mediaDetail.captionText!!,
|
||||
mediaDetail.captionText,
|
||||
).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe { s: Boolean? ->
|
||||
updatedCaptions[mediaDetail.languageCode!!] = mediaDetail.captionText!!
|
||||
updatedCaptions[mediaDetail.languageCode!!] = mediaDetail.captionText
|
||||
media.captions = updatedCaptions
|
||||
Timber.d("Caption is added.")
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1586,7 +1586,7 @@ class MediaDetailFragment : CommonsDaggerSupportFragment(), CategoryEditHelper.C
|
|||
mediaDetail: UploadMediaDetail,
|
||||
updatedCaptions: MutableMap<String, String>
|
||||
) {
|
||||
updatedCaptions[mediaDetail.languageCode!!] = mediaDetail.captionText!!
|
||||
updatedCaptions[mediaDetail.languageCode!!] = mediaDetail.captionText
|
||||
media!!.captions = updatedCaptions
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ data class UploadMediaDetail(
|
|||
* The caption text for the item being uploaded.
|
||||
* @param captionText The caption text.
|
||||
*/
|
||||
var captionText: String? = "",
|
||||
var captionText: String = "",
|
||||
) : Parcelable {
|
||||
fun javaCopy() = copy()
|
||||
|
||||
constructor(place: Place?) : this(
|
||||
place?.language,
|
||||
place?.longDescription,
|
||||
place?.name,
|
||||
place?.name ?: "",
|
||||
)
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class CategoriesPresenter
|
|||
*/
|
||||
private fun getImageTitleList(): List<String> =
|
||||
repository.getUploads()
|
||||
.map { it.uploadMediaDetails[0].captionText!! }
|
||||
.map { it.uploadMediaDetails[0].captionText }
|
||||
.filterNot { TextUtils.isEmpty(it) }
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue