From 0a77d5014e778d1d5a18c66f2f218609d27ee95f Mon Sep 17 00:00:00 2001 From: onurays Date: Thu, 26 Mar 2020 17:19:29 +0300 Subject: [PATCH] Fix nullability issues. --- .../im/vector/riotx/core/files/FileSaver.kt | 26 +++++++------------ .../core/glide/VectorGlideModelLoader.kt | 2 +- .../core/platform/EllipsizingTextView.kt | 2 +- .../riotx/core/platform/VectorBaseActivity.kt | 2 +- .../vector/riotx/core/services/CallService.kt | 8 +++--- .../im/vector/riotx/core/utils/Debouncer.kt | 7 ++--- .../im/vector/riotx/core/utils/FileUtils.kt | 2 +- .../im/vector/riotx/core/utils/TextUtils.kt | 4 +-- .../preview/AttachmentsPreviewActivity.kt | 2 +- .../setup/KeysBackupSetupActivity.kt | 2 +- .../quads/SharedSecureStorageViewModel.kt | 4 +-- .../VerificationBottomSheetViewModel.kt | 4 ++- .../home/room/detail/RoomDetailFragment.kt | 2 +- .../media/ImageMediaViewerActivity.kt | 9 ++++++- .../media/VideoMediaViewerActivity.kt | 11 +++++--- .../NotificationBroadcastReceiver.kt | 2 +- .../features/rageshake/VectorFileLogger.kt | 2 +- .../roompreview/RoomPreviewActivity.kt | 2 +- .../riotx/features/settings/VectorLocale.kt | 6 ++--- .../features/settings/VectorPreferences.kt | 9 +++---- .../VectorSettingsSecurityPrivacyFragment.kt | 2 +- 21 files changed, 57 insertions(+), 53 deletions(-) diff --git a/vector/src/main/java/im/vector/riotx/core/files/FileSaver.kt b/vector/src/main/java/im/vector/riotx/core/files/FileSaver.kt index 493f2e22cb..1b9eca984c 100644 --- a/vector/src/main/java/im/vector/riotx/core/files/FileSaver.kt +++ b/vector/src/main/java/im/vector/riotx/core/files/FileSaver.kt @@ -16,10 +16,8 @@ package im.vector.riotx.core.files -import android.app.DownloadManager import android.content.ContentValues import android.content.Context -import android.os.Build import android.provider.MediaStore import androidx.annotation.WorkerThread import arrow.core.Try @@ -57,23 +55,17 @@ fun addEntryToDownloadManager(context: Context, mimeType: String, title: String = file.name, description: String = file.name) { - val downloadManager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager? - try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - val contentValues = ContentValues().apply { - put(MediaStore.Downloads.TITLE, title) - put(MediaStore.Downloads.DISPLAY_NAME, description) - put(MediaStore.Downloads.MIME_TYPE, mimeType) - put(MediaStore.Downloads.SIZE, file.length()) + val contentValues = ContentValues().apply { + put(MediaStore.Downloads.TITLE, title) + put(MediaStore.Downloads.DISPLAY_NAME, description) + put(MediaStore.Downloads.MIME_TYPE, mimeType) + put(MediaStore.Downloads.SIZE, file.length()) + } + context.contentResolver.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues)?.let { uri -> + context.contentResolver.openOutputStream(uri)?.use { outputStream -> + outputStream.sink().buffer().write(file.inputStream().use { it.readBytes() }) } - context.contentResolver.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, contentValues)?.let { uri -> - context.contentResolver.openOutputStream(uri)?.use { outputStream -> - outputStream.sink().buffer().write(file.inputStream().use { it.readBytes() }) - } - } - } else { - downloadManager?.addCompletedDownload(title, description, true, mimeType, file.absolutePath, file.length(), true) } } catch (e: Exception) { Timber.e(e, "## addEntryToDownloadManager(): Exception") diff --git a/vector/src/main/java/im/vector/riotx/core/glide/VectorGlideModelLoader.kt b/vector/src/main/java/im/vector/riotx/core/glide/VectorGlideModelLoader.kt index 1a90b0c34f..191ab6d972 100644 --- a/vector/src/main/java/im/vector/riotx/core/glide/VectorGlideModelLoader.kt +++ b/vector/src/main/java/im/vector/riotx/core/glide/VectorGlideModelLoader.kt @@ -95,7 +95,7 @@ class VectorGlideDataFetcher(private val activeSessionHolder: ActiveSessionHolde override fun loadData(priority: Priority, callback: DataFetcher.DataCallback) { Timber.v("Load data: $data") - if (data.isLocalFile()) { + if (data.isLocalFile() && data.url != null) { val initialFile = File(data.url) callback.onDataReady(FileInputStream(initialFile)) return diff --git a/vector/src/main/java/im/vector/riotx/core/platform/EllipsizingTextView.kt b/vector/src/main/java/im/vector/riotx/core/platform/EllipsizingTextView.kt index 2e5786b57d..f451308c36 100644 --- a/vector/src/main/java/im/vector/riotx/core/platform/EllipsizingTextView.kt +++ b/vector/src/main/java/im/vector/riotx/core/platform/EllipsizingTextView.kt @@ -333,7 +333,7 @@ class EllipsizingTextView @JvmOverloads constructor(context: Context, attrs: Att * @param workingText text to strip end punctuation from * @return Text without end punctuation. */ - fun stripEndPunctuation(workingText: CharSequence?): String { + fun stripEndPunctuation(workingText: CharSequence): String { return mEndPunctPattern!!.matcher(workingText).replaceFirst("") } } diff --git a/vector/src/main/java/im/vector/riotx/core/platform/VectorBaseActivity.kt b/vector/src/main/java/im/vector/riotx/core/platform/VectorBaseActivity.kt index 2649662ee5..ea954ecf27 100644 --- a/vector/src/main/java/im/vector/riotx/core/platform/VectorBaseActivity.kt +++ b/vector/src/main/java/im/vector/riotx/core/platform/VectorBaseActivity.kt @@ -134,7 +134,7 @@ abstract class VectorBaseActivity : AppCompatActivity(), HasScreenInjector { restorables.forEach { it.onSaveInstanceState(outState) } } - override fun onRestoreInstanceState(savedInstanceState: Bundle?) { + override fun onRestoreInstanceState(savedInstanceState: Bundle) { restorables.forEach { it.onRestoreInstanceState(savedInstanceState) } super.onRestoreInstanceState(savedInstanceState) } diff --git a/vector/src/main/java/im/vector/riotx/core/services/CallService.kt b/vector/src/main/java/im/vector/riotx/core/services/CallService.kt index f36b289aaa..30ab62d5b2 100644 --- a/vector/src/main/java/im/vector/riotx/core/services/CallService.kt +++ b/vector/src/main/java/im/vector/riotx/core/services/CallService.kt @@ -128,13 +128,13 @@ class CallService : VectorService() { * Display a call in progress notification. */ private fun displayCallInProgressNotification(intent: Intent) { - val callId = intent.getStringExtra(EXTRA_CALL_ID) + val callId = intent.getStringExtra(EXTRA_CALL_ID) ?: "" val notification = notificationUtils.buildPendingCallNotification( intent.getBooleanExtra(EXTRA_IS_VIDEO, false), - intent.getStringExtra(EXTRA_ROOM_NAME), - intent.getStringExtra(EXTRA_ROOM_ID), - intent.getStringExtra(EXTRA_MATRIX_ID), + intent.getStringExtra(EXTRA_ROOM_NAME) ?: "", + intent.getStringExtra(EXTRA_ROOM_ID) ?: "", + intent.getStringExtra(EXTRA_MATRIX_ID) ?: "", callId) startForeground(NOTIFICATION_ID, notification) diff --git a/vector/src/main/java/im/vector/riotx/core/utils/Debouncer.kt b/vector/src/main/java/im/vector/riotx/core/utils/Debouncer.kt index 627d757574..95035f6c96 100644 --- a/vector/src/main/java/im/vector/riotx/core/utils/Debouncer.kt +++ b/vector/src/main/java/im/vector/riotx/core/utils/Debouncer.kt @@ -37,9 +37,10 @@ class Debouncer(private val handler: Handler) { fun cancel(identifier: String) { if (runnables.containsKey(identifier)) { - val old = runnables[identifier] - handler.removeCallbacks(old) - runnables.remove(identifier) + runnables[identifier]?.let { + handler.removeCallbacks(it) + runnables.remove(identifier) + } } } diff --git a/vector/src/main/java/im/vector/riotx/core/utils/FileUtils.kt b/vector/src/main/java/im/vector/riotx/core/utils/FileUtils.kt index 1a19b49872..839356a129 100644 --- a/vector/src/main/java/im/vector/riotx/core/utils/FileUtils.kt +++ b/vector/src/main/java/im/vector/riotx/core/utils/FileUtils.kt @@ -73,7 +73,7 @@ private fun logAction(file: File): Boolean { */ private fun recursiveActionOnFile(file: File, action: ActionOnFile): Boolean { if (file.isDirectory) { - file.list().forEach { + file.list()?.forEach { val result = recursiveActionOnFile(File(file, it), action) if (!result) { diff --git a/vector/src/main/java/im/vector/riotx/core/utils/TextUtils.kt b/vector/src/main/java/im/vector/riotx/core/utils/TextUtils.kt index 75f6893c7c..9519eb1f9d 100644 --- a/vector/src/main/java/im/vector/riotx/core/utils/TextUtils.kt +++ b/vector/src/main/java/im/vector/riotx/core/utils/TextUtils.kt @@ -35,8 +35,8 @@ object TextUtils { if (value < 1000) return value.toString() // deal with easy case val e = suffixes.floorEntry(value) - val divideBy = e.key - val suffix = e.value + val divideBy = e?.key + val suffix = e?.value val truncated = value / (divideBy!! / 10) // the number part of the output times 10 val hasDecimal = truncated < 100 && truncated / 10.0 != (truncated / 10).toDouble() diff --git a/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewActivity.kt b/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewActivity.kt index 46a90803ca..6c91f70131 100644 --- a/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/attachments/preview/AttachmentsPreviewActivity.kt @@ -43,7 +43,7 @@ class AttachmentsPreviewActivity : VectorBaseActivity(), ToolbarConfigurable { } fun getOutput(intent: Intent): List { - return intent.getParcelableArrayListExtra(ATTACHMENTS_PREVIEW_RESULT) + return intent.getParcelableArrayListExtra(ATTACHMENTS_PREVIEW_RESULT) ?: emptyList() } fun getKeepOriginalSize(intent: Intent): Boolean { diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt b/vector/src/main/java/im/vector/riotx/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt index 924e25a4d7..72f6bf346d 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/keysbackup/setup/KeysBackupSetupActivity.kt @@ -153,7 +153,7 @@ class KeysBackupSetupActivity : SimpleFragmentActivity() { } override fun onFailure(failure: Throwable) { - toast(failure.localizedMessage) + failure.localizedMessage?.let { toast(it) } hideWaitingView() } }) diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/quads/SharedSecureStorageViewModel.kt b/vector/src/main/java/im/vector/riotx/features/crypto/quads/SharedSecureStorageViewModel.kt index a9f5d33888..4b27010f8f 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/quads/SharedSecureStorageViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/quads/SharedSecureStorageViewModel.kt @@ -158,8 +158,8 @@ class SharedSecureStorageViewModel @AssistedInject constructor( @JvmStatic override fun create(viewModelContext: ViewModelContext, state: SharedSecureStorageViewState): SharedSecureStorageViewModel? { val activity: SharedSecureStorageActivity = viewModelContext.activity() - val args: SharedSecureStorageActivity.Args = activity.intent.getParcelableExtra(MvRx.KEY_ARG) - return activity.viewModelFactory.create(state, args) + val args: SharedSecureStorageActivity.Args? = activity.intent.getParcelableExtra(MvRx.KEY_ARG) + return args?.let { activity.viewModelFactory.create(state, it) } } } } diff --git a/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheetViewModel.kt b/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheetViewModel.kt index 731f12cca4..f273e41ccb 100644 --- a/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheetViewModel.kt +++ b/vector/src/main/java/im/vector/riotx/features/crypto/verification/VerificationBottomSheetViewModel.kt @@ -357,7 +357,9 @@ class VerificationBottomSheetViewModel @AssistedInject constructor( } } } catch (failure: Throwable) { - _viewEvents.post(VerificationBottomSheetViewEvents.ModalError(failure.localizedMessage)) + failure.localizedMessage?.let { + _viewEvents.post(VerificationBottomSheetViewEvents.ModalError(it)) + } } } }.exhaustive diff --git a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt index f58d7be718..0ecc361d04 100644 --- a/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/home/room/detail/RoomDetailFragment.kt @@ -782,7 +782,7 @@ class RoomDetailFragment @Inject constructor( updateComposerText("") } is RoomDetailViewEvents.SlashCommandResultError -> { - displayCommandError(sendMessageResult.throwable.localizedMessage) + sendMessageResult.throwable.localizedMessage?.let { displayCommandError(it) } } is RoomDetailViewEvents.SlashCommandNotImplemented -> { displayCommandError(getString(R.string.not_implemented)) diff --git a/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt b/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt index d9da08254f..8ba21468b7 100644 --- a/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/media/ImageMediaViewerActivity.kt @@ -56,10 +56,17 @@ class ImageMediaViewerActivity : VectorBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(im.vector.riotx.R.layout.activity_image_media_viewer) - mediaData = intent.getParcelableExtra(EXTRA_MEDIA_DATA) + + if (intent.hasExtra(EXTRA_MEDIA_DATA)) { + mediaData = intent.getParcelableExtra(EXTRA_MEDIA_DATA)!! + } else { + finish() + } + intent.extras?.getString(EXTRA_SHARED_TRANSITION_NAME)?.let { ViewCompat.setTransitionName(imageTransitionView, it) } + if (mediaData.url.isNullOrEmpty()) { supportFinishAfterTransition() return diff --git a/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt b/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt index 9c3312f3bb..e92b58c681 100644 --- a/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/media/VideoMediaViewerActivity.kt @@ -37,11 +37,14 @@ class VideoMediaViewerActivity : VectorBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(im.vector.riotx.R.layout.activity_video_media_viewer) - val mediaData = intent.getParcelableExtra(EXTRA_MEDIA_DATA) - configureToolbar(videoMediaViewerToolbar, mediaData) - imageContentRenderer.render(mediaData.thumbnailMediaData, ImageContentRenderer.Mode.FULL_SIZE, videoMediaViewerThumbnailView) - videoContentRenderer.render(mediaData, videoMediaViewerThumbnailView, videoMediaViewerLoading, videoMediaViewerVideoView, videoMediaViewerErrorView) + if (intent.hasExtra(EXTRA_MEDIA_DATA)) { + val mediaData = intent.getParcelableExtra(EXTRA_MEDIA_DATA)!! + + configureToolbar(videoMediaViewerToolbar, mediaData) + imageContentRenderer.render(mediaData.thumbnailMediaData, ImageContentRenderer.Mode.FULL_SIZE, videoMediaViewerThumbnailView) + videoContentRenderer.render(mediaData, videoMediaViewerThumbnailView, videoMediaViewerLoading, videoMediaViewerVideoView, videoMediaViewerErrorView) + } } private fun configureToolbar(toolbar: Toolbar, mediaData: VideoContentRenderer.Data) { diff --git a/vector/src/main/java/im/vector/riotx/features/notifications/NotificationBroadcastReceiver.kt b/vector/src/main/java/im/vector/riotx/features/notifications/NotificationBroadcastReceiver.kt index 53d69bce2d..04b267fb3a 100644 --- a/vector/src/main/java/im/vector/riotx/features/notifications/NotificationBroadcastReceiver.kt +++ b/vector/src/main/java/im/vector/riotx/features/notifications/NotificationBroadcastReceiver.kt @@ -97,7 +97,7 @@ class NotificationBroadcastReceiver : BroadcastReceiver() { val message = getReplyMessage(intent) val roomId = intent.getStringExtra(KEY_ROOM_ID) - if (message.isNullOrBlank() || roomId.isBlank()) { + if (message.isNullOrBlank() || roomId.isNullOrBlank()) { // ignore this event // Can this happen? should we update notification? return diff --git a/vector/src/main/java/im/vector/riotx/features/rageshake/VectorFileLogger.kt b/vector/src/main/java/im/vector/riotx/features/rageshake/VectorFileLogger.kt index 16e231491a..ce1b44be21 100644 --- a/vector/src/main/java/im/vector/riotx/features/rageshake/VectorFileLogger.kt +++ b/vector/src/main/java/im/vector/riotx/features/rageshake/VectorFileLogger.kt @@ -65,7 +65,7 @@ class VectorFileLogger @Inject constructor(val context: Context, private val vec sFileHandler?.formatter = LogFormatter() sLogger.useParentHandlers = false sLogger.level = Level.ALL - sLogger.addHandler(sFileHandler) + sFileHandler?.let { sLogger.addHandler(it) } } } catch (e: Throwable) { Timber.e(e, "Failed to initialize FileLogger") diff --git a/vector/src/main/java/im/vector/riotx/features/roomdirectory/roompreview/RoomPreviewActivity.kt b/vector/src/main/java/im/vector/riotx/features/roomdirectory/roompreview/RoomPreviewActivity.kt index a7cb8f2f68..3cb442127f 100644 --- a/vector/src/main/java/im/vector/riotx/features/roomdirectory/roompreview/RoomPreviewActivity.kt +++ b/vector/src/main/java/im/vector/riotx/features/roomdirectory/roompreview/RoomPreviewActivity.kt @@ -70,7 +70,7 @@ class RoomPreviewActivity : VectorBaseActivity(), ToolbarConfigurable { if (isFirstCreation()) { val args = intent.getParcelableExtra(ARG) - if (args.worldReadable) { + if (args?.worldReadable == true) { // TODO Room preview: Note: M does not recommend to use /events anymore, so for now we just display the room preview // TODO the same way if it was not world readable addFragment(R.id.simpleFragmentContainer, RoomPreviewNoPreviewFragment::class.java, args) diff --git a/vector/src/main/java/im/vector/riotx/features/settings/VectorLocale.kt b/vector/src/main/java/im/vector/riotx/features/settings/VectorLocale.kt index b1bdb6d84a..e1a89ab3c4 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/VectorLocale.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/VectorLocale.kt @@ -59,9 +59,9 @@ object VectorLocale { val preferences = PreferenceManager.getDefaultSharedPreferences(context) if (preferences.contains(APPLICATION_LOCALE_LANGUAGE_KEY)) { - applicationLocale = Locale(preferences.getString(APPLICATION_LOCALE_LANGUAGE_KEY, ""), - preferences.getString(APPLICATION_LOCALE_COUNTRY_KEY, ""), - preferences.getString(APPLICATION_LOCALE_VARIANT_KEY, "") + applicationLocale = Locale(preferences.getString(APPLICATION_LOCALE_LANGUAGE_KEY, "")!!, + preferences.getString(APPLICATION_LOCALE_COUNTRY_KEY, "")!!, + preferences.getString(APPLICATION_LOCALE_VARIANT_KEY, "")!! ) } else { applicationLocale = Locale.getDefault() diff --git a/vector/src/main/java/im/vector/riotx/features/settings/VectorPreferences.kt b/vector/src/main/java/im/vector/riotx/features/settings/VectorPreferences.kt index 9473c26055..faa48d5686 100755 --- a/vector/src/main/java/im/vector/riotx/features/settings/VectorPreferences.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/VectorPreferences.kt @@ -29,7 +29,6 @@ import im.vector.riotx.R import im.vector.riotx.features.homeserver.ServerUrlsRepository import im.vector.riotx.features.themes.ThemeUtils import timber.log.Timber -import java.io.File import javax.inject.Inject class VectorPreferences @Inject constructor(private val context: Context) { @@ -68,7 +67,7 @@ class VectorPreferences @Inject constructor(private val context: Context) { const val SETTINGS_ENCRYPTION_EXPORT_E2E_ROOM_KEYS_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_EXPORT_E2E_ROOM_KEYS_PREFERENCE_KEY" const val SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_IMPORT_E2E_ROOM_KEYS_PREFERENCE_KEY" const val SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY = "SETTINGS_ENCRYPTION_NEVER_SENT_TO_PREFERENCE_KEY" - const val SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY = "SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY" + const val SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY = "SETTINGS_SHOW_DEVICES_LIST_PREFERENCE_KEY" const val SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY = "SETTINGS_SECURE_MESSAGE_RECOVERY_PREFERENCE_KEY" @@ -427,11 +426,11 @@ class VectorPreferences @Inject constructor(private val context: Context) { val toneUri = getNotificationRingTone() ?: return null try { - val proj = arrayOf(MediaStore.Audio.Media.DATA) + val proj = arrayOf(MediaStore.Audio.Media.DISPLAY_NAME) return context.contentResolver.query(toneUri, proj, null, null, null)?.use { - val columnIndex = it.getColumnIndexOrThrow(MediaStore.Audio.Media.DATA) + val columnIndex = it.getColumnIndexOrThrow(MediaStore.Audio.Media.DISPLAY_NAME) it.moveToFirst() - File(it.getString(columnIndex)).nameWithoutExtension + it.getString(columnIndex) } } catch (e: Exception) { Timber.e(e, "## getNotificationRingToneName() failed") diff --git a/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsSecurityPrivacyFragment.kt b/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsSecurityPrivacyFragment.kt index 4324c79dfd..91b3593cd0 100644 --- a/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsSecurityPrivacyFragment.kt +++ b/vector/src/main/java/im/vector/riotx/features/settings/VectorSettingsSecurityPrivacyFragment.kt @@ -332,7 +332,7 @@ class VectorSettingsSecurityPrivacyFragment @Inject constructor( } override fun onFailure(failure: Throwable) { - appContext.toast(failure.localizedMessage) + failure.localizedMessage?.let { appContext.toast(it) } hideLoadingView() } })