From e053210b84090971d63fbd11db89860afe00d4e0 Mon Sep 17 00:00:00 2001 From: Petros Paraskevopoulos Date: Fri, 23 Sep 2022 15:52:19 +0300 Subject: [PATCH] Analysis: Resolve unnecessary safe call type warning Warning Message: "Unnecessary safe call on a non-null receiver of type CharSequence. This expression will have nullable type in future releases" The 'mPositiveButtonLabel' is being reverted back to being a nullable field, that is, instead of it being a 'lateinit' non-null field. PS: This field was nullable in the past, but this 24a053275df69f69924ab7dbf9ff60787ce30f8d commit made it into 'lateinit' non-null. --- .../android/editor/gutenberg/GutenbergDialogFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt index 4af7ca12b71d..4bc6c6f90cc6 100644 --- a/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt +++ b/libs/editor/src/main/java/org/wordpress/android/editor/gutenberg/GutenbergDialogFragment.kt @@ -11,7 +11,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder class GutenbergDialogFragment : AppCompatDialogFragment() { private lateinit var mTag: String private lateinit var mMessage: CharSequence - private lateinit var mPositiveButtonLabel: CharSequence + private var mPositiveButtonLabel: CharSequence? = null private var mTitle: CharSequence? = null private var mNegativeButtonLabel: CharSequence? = null private var mId: Int = 0 @@ -56,7 +56,7 @@ class GutenbergDialogFragment : AppCompatDialogFragment() { mTag = requireNotNull(savedInstanceState.getString(STATE_KEY_TAG)) mTitle = savedInstanceState.getCharSequence(STATE_KEY_TITLE) mMessage = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_MESSAGE)) - mPositiveButtonLabel = requireNotNull(savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL)) + mPositiveButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_POSITIVE_BUTTON_LABEL) mNegativeButtonLabel = savedInstanceState.getCharSequence(STATE_KEY_NEGATIVE_BUTTON_LABEL) mId = savedInstanceState.getInt(STATE_KEY_ID) }