Skip to content

Commit d181510

Browse files
authored
Merge pull request #6596 from nextcloud/bugfix/noid/fixNpeInOpenInFilesApp
fix(chat): Avoid NPE when opening a file attachment in the Files app
2 parents 270d7a3 + b9fbc94 commit d181510

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3920,8 +3920,12 @@ class ChatActivity :
39203920
fun openInFilesApp(message: ChatMessage) {
39213921
val keyID = message.fileParameters.id
39223922
val link = message.fileParameters.link
3923-
val fileViewerUtils = FileViewerUtils(this, message.activeUser!!)
3924-
fileViewerUtils.openFileInFilesApp(link!!, keyID!!)
3923+
if (keyID.isEmpty() || link.isEmpty()) {
3924+
Snackbar.make(binding.root, R.string.nc_common_error_sorry, Snackbar.LENGTH_LONG).show()
3925+
return
3926+
}
3927+
val fileViewerUtils = FileViewerUtils(this, conversationUser)
3928+
fileViewerUtils.openFileInFilesApp(link, keyID)
39253929
}
39263930

39273931
private fun hasVisibleItems(message: ChatMessage): Boolean =

0 commit comments

Comments
 (0)