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) }