From fdbff4a8e67153e79514450a84da14b8d8b46c82 Mon Sep 17 00:00:00 2001 From: sowjanyakch Date: Tue, 26 Nov 2024 12:12:03 +0100 Subject: [PATCH] use safe call operator Signed-off-by: sowjanyakch --- .../talk/ui/dialog/SetStatusDialogFragment.kt | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt index ff4ddb401..a411de7d5 100644 --- a/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt +++ b/app/src/main/java/com/nextcloud/talk/ui/dialog/SetStatusDialogFragment.kt @@ -176,19 +176,21 @@ class SetStatusDialogFragment : @SuppressLint("NotifyDataSetChanged") override fun onNext(statusOverall: StatusOverall) { if (statusOverall.ocs?.meta?.statusCode == HTTP_STATUS_CODE_OK) { - backupStatus = statusOverall.ocs?.data!! - if (backupStatus.message != null) { - isBackupStatusAvailable = true - val backupPredefinedStatus = PredefinedStatus( - backupStatus.userId!!, - backupStatus.icon, - backupStatus.message!!, - ClearAt(type = "period", time = backupStatus.clearAt.toString()) - ) - binding.automaticStatus.visibility = View.VISIBLE - adapter.isBackupStatusAvailable = true - predefinedStatusesList.add(0, backupPredefinedStatus) - adapter.notifyDataSetChanged() + statusOverall.ocs?.data?.let { status -> + backupStatus = status + if (backupStatus.message != null) { + isBackupStatusAvailable = true + val backupPredefinedStatus = PredefinedStatus( + backupStatus.userId!!, + backupStatus.icon, + backupStatus.message!!, + ClearAt(type = "period", time = backupStatus.clearAt.toString()) + ) + binding.automaticStatus.visibility = View.VISIBLE + adapter.isBackupStatusAvailable = true + predefinedStatusesList.add(0, backupPredefinedStatus) + adapter.notifyDataSetChanged() + } } } }