Aperture: Run whole updateGalleryButton() on UI thread

Fixes crash when uri is null.

Change-Id: Ib3ee3ba7fd096399ad94919d6bb21ed67f6229fb
diff --git a/app/src/main/java/org/lineageos/aperture/MainActivity.kt b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
index e9cabc1..98bcb53 100644
--- a/app/src/main/java/org/lineageos/aperture/MainActivity.kt
+++ b/app/src/main/java/org/lineageos/aperture/MainActivity.kt
@@ -811,19 +811,19 @@
     }
 
     private fun updateGalleryButton(uri: Uri?, enable: Boolean = true) {
-        if (uri != null && enable) {
-            getThumbnail(uri)?.let {
-                runOnUiThread {
+        runOnUiThread {
+            if (uri != null && enable) {
+                getThumbnail(uri)?.let {
                     galleryButton.setPadding(0)
                     galleryButton.setImageBitmap(it)
                 }
+            } else if (keyguardManager.isKeyguardLocked) {
+                galleryButton.setPadding(convertDpToPx(15))
+                galleryButton.setImageResource(R.drawable.ic_lock)
+            } else {
+                galleryButton.setPadding(convertDpToPx(15))
+                galleryButton.setImageResource(R.drawable.ic_image)
             }
-        } else if (keyguardManager.isKeyguardLocked) {
-            galleryButton.setPadding(convertDpToPx(15))
-            galleryButton.setImageResource(R.drawable.ic_lock)
-        } else {
-            galleryButton.setPadding(convertDpToPx(15))
-            galleryButton.setImageResource(R.drawable.ic_image)
         }
     }