Fix crash on AttachmentViewer (#2365)
Not sure how to reproduce it, but if the value is -1, it will crash for sure
This commit is contained in:
parent
816301bf8d
commit
83467b8597
|
@ -8,6 +8,7 @@ Improvements 🙌:
|
|||
- Open an existing DM instead of creating a new one (#2319)
|
||||
|
||||
Bugfix 🐛:
|
||||
- Fix crash on AttachmentViewer (#2365)
|
||||
- Fix issue when updating the avatar of a room (new avatar vanishing)
|
||||
- Discard change dialog displayed by mistake when avatar has been updated
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
|
|||
val inMemoryData = intent.getParcelableArrayListExtra<AttachmentData>(EXTRA_IN_MEMORY_DATA)
|
||||
if (inMemoryData != null) {
|
||||
val sourceProvider = dataSourceFactory.createProvider(inMemoryData, room)
|
||||
initialIndex = inMemoryData.indexOfFirst { it.eventId == args.eventId }
|
||||
initialIndex = inMemoryData.indexOfFirst { it.eventId == args.eventId }.coerceAtLeast(0)
|
||||
sourceProvider.interactionListener = this
|
||||
setSourceProvider(sourceProvider)
|
||||
this.currentSourceProvider = sourceProvider
|
||||
|
@ -132,7 +132,7 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
|
|||
}
|
||||
} else {
|
||||
val events = room?.getAttachmentMessages().orEmpty()
|
||||
initialIndex = events.indexOfFirst { it.eventId == args.eventId }
|
||||
initialIndex = events.indexOfFirst { it.eventId == args.eventId }.coerceAtLeast(0)
|
||||
val sourceProvider = dataSourceFactory.createProvider(events)
|
||||
sourceProvider.interactionListener = this
|
||||
setSourceProvider(sourceProvider)
|
||||
|
|
Loading…
Reference in New Issue