Compact code

This commit is contained in:
Benoit Marty 2021-10-20 18:10:42 +02:00 committed by Adam Brown
parent c56101d227
commit 2bd2cbf84e
1 changed files with 3 additions and 5 deletions

View File

@ -160,12 +160,10 @@ class RoomGroupMessageCreator @Inject constructor(
} }
private fun getRoomBitmap(events: List<NotifiableMessageEvent>): Bitmap? { private fun getRoomBitmap(events: List<NotifiableMessageEvent>): Bitmap? {
if (events.isEmpty()) return null
// Use the last event (most recent?) // Use the last event (most recent?)
val roomAvatarPath = events.last().roomAvatarPath return events.lastOrNull()
?.roomAvatarPath
return bitmapLoader.getRoomBitmap(roomAvatarPath) ?.let { bitmapLoader.getRoomBitmap(it) }
} }
} }