From 1b7dc3025924f8975281c542a4e2aa08a22bb477 Mon Sep 17 00:00:00 2001 From: lukstbit <52494258+lukstbit@users.noreply.github.com> Date: Sat, 29 Jul 2023 10:33:48 +0300 Subject: [PATCH] Fix crash in BasicImageFieldController due to uninitialized properties See https://ankidroid.org/acra/app/1/bug/61331/report/745e50d4-67c2-45ac-87bf-48ba22a3ba53 --- .../anki/multimediacard/fields/BasicImageFieldController.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt index 470677a9dc81..1d3a9ca93114 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/multimediacard/fields/BasicImageFieldController.kt @@ -599,8 +599,8 @@ class BasicImageFieldController : FieldControllerBase(), IFieldController { // ensure the previous preview is not visible private fun hideImagePreview() { BitmapUtil.freeImageView(mImagePreview) - mCropButton.visibility = View.INVISIBLE - mImageFileSize.visibility = View.INVISIBLE + if (::mCropButton.isInitialized) mCropButton.visibility = View.INVISIBLE + if (::mImageFileSize.isInitialized) mImageFileSize.visibility = View.INVISIBLE } override fun onDestroy() {