From fe9b20849306821195875664645c3769bf2c6386 Mon Sep 17 00:00:00 2001 From: Aitor Viana Date: Tue, 21 Jan 2025 12:23:31 +0000 Subject: [PATCH] Check late property is isInitialized --- .../duckduckgo/voice/impl/VoiceSearchActivityLauncher.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/voice-search/voice-search-impl/src/main/java/com/duckduckgo/voice/impl/VoiceSearchActivityLauncher.kt b/voice-search/voice-search-impl/src/main/java/com/duckduckgo/voice/impl/VoiceSearchActivityLauncher.kt index 040dbbd849bf..31eed9098f2d 100644 --- a/voice-search/voice-search-impl/src/main/java/com/duckduckgo/voice/impl/VoiceSearchActivityLauncher.kt +++ b/voice-search/voice-search-impl/src/main/java/com/duckduckgo/voice/impl/VoiceSearchActivityLauncher.kt @@ -62,7 +62,7 @@ class RealVoiceSearchActivityLauncher @Inject constructor( private const val SUGGEST_REMOVE_VOICE_SEARCH_AFTER_TIMES = 3 } - private lateinit var _source: Source + private var _source: Source? = null override fun registerResultsCallback( caller: ActivityResultCaller, @@ -78,7 +78,7 @@ class RealVoiceSearchActivityLauncher @Inject constructor( if (data.isNotEmpty()) { pixel.fire( pixel = VoiceSearchPixelNames.VOICE_SEARCH_DONE, - parameters = mapOf(KEY_PARAM_SOURCE to _source.paramValueName), + parameters = mapOf(KEY_PARAM_SOURCE to _source?.paramValueName.orEmpty()), ) voiceSearchRepository.resetVoiceSearchDismissed() onEvent(Event.VoiceRecognitionSuccess(data)) @@ -132,7 +132,7 @@ class RealVoiceSearchActivityLauncher @Inject constructor( } pixel.fire( pixel = VoiceSearchPixelNames.VOICE_SEARCH_STARTED, - parameters = mapOf(KEY_PARAM_SOURCE to _source.paramValueName), + parameters = mapOf(KEY_PARAM_SOURCE to _source?.paramValueName.orEmpty()), ) activityResultLauncherWrapper.launch(LaunchVoiceSearch) }