From 55f6f934ffdc27a78260e6cf763abd81a656613b Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 14 May 2017 20:43:03 +0200 Subject: [PATCH] add some null checks to checking if primary color changed --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index a57ec49e3..0890b2812 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -194,7 +194,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun checkIfColorChanged() { - if (getRecyclerAdapter().foregroundColor != config.primaryColor) { + if (directories_grid.adapter != null && getRecyclerAdapter().foregroundColor != config.primaryColor) { getRecyclerAdapter().updatePrimaryColor(config.primaryColor) directories_fastscroller.updateHandleColor() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index ec6529420..554d4f80b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -107,7 +107,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun checkIfColorChanged() { - if (getRecyclerAdapter().foregroundColor != config.primaryColor) { + if (media_grid.adapter != null && getRecyclerAdapter().foregroundColor != config.primaryColor) { getRecyclerAdapter().updatePrimaryColor(config.primaryColor) media_fastscroller.updateHandleColor() }