Skip to content

Commit 1be0010

Browse files
committed
avoid crash when event start time is not a valid long
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
1 parent 93e041b commit 1be0010

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,10 +679,9 @@ class ConversationsListActivity :
679679
}
680680

681681
private fun isFutureEvent(conversation: ConversationModel): Boolean {
682-
if (!conversation.objectId.contains("#")) {
683-
return false
684-
}
685-
val eventTimeStart = conversation.objectId.split("#")[0].toLong()
682+
val eventTimeStart = conversation.objectId
683+
.substringBefore("#")
684+
.toLongOrNull() ?: return false
686685
val currentTimeStampInSeconds = System.currentTimeMillis() / LONG_1000
687686
val sixteenHoursAfterTimeStamp = (eventTimeStart - currentTimeStampInSeconds) > SIXTEEN_HOURS_IN_SECONDS
688687
return conversation.objectType == ConversationEnums.ObjectType.EVENT && sixteenHoursAfterTimeStamp

0 commit comments

Comments
 (0)