Skip to content

Commit 76c3a11

Browse files
authored
Fix UninitializedPropertyAccessException in geoswitching (#6362)
Task/Issue URL: https://app.asana.com/1/137249556945/project/1202552961248957/task/1210704215272651?focus=true ### Description Remove lateinit for lastSelectedButton and just make it nullable ### Steps to test this PR _VPN_ - [ ] Obtain PrivacyPro subscription - [ ] Open VPN screen - [ ] Enable VPN and quickly open geoswitching screen by pressing selected location - [ ] Verify no crash happens
1 parent 654a314 commit 76c3a11

File tree

1 file changed

+3
-3
lines changed
  • network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/settings/geoswitching

1 file changed

+3
-3
lines changed

network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/settings/geoswitching/NetpGeoswitchingActivity.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import kotlinx.coroutines.flow.onEach
4444
class NetpGeoswitchingActivity : DuckDuckGoActivity() {
4545
private val binding: ActivityNetpGeoswitchingBinding by viewBinding()
4646
private val viewModel: NetpGeoSwitchingViewModel by bindViewModel()
47-
private lateinit var lastSelectedButton: CompoundButton
47+
private var lastSelectedButton: CompoundButton? = null
4848

4949
override fun onCreate(savedInstanceState: Bundle?) {
5050
super.onCreate(savedInstanceState)
@@ -110,7 +110,7 @@ class NetpGeoswitchingActivity : DuckDuckGoActivity() {
110110

111111
this.radioButton.setOnCheckedChangeListener { view, isChecked ->
112112
if (isChecked && view != lastSelectedButton) {
113-
lastSelectedButton.isChecked = false
113+
lastSelectedButton?.isChecked = false
114114
lastSelectedButton = view
115115
viewModel.onNearestAvailableCountrySelected()
116116
}
@@ -154,7 +154,7 @@ class NetpGeoswitchingActivity : DuckDuckGoActivity() {
154154

155155
itemBinding.root.radioButton.setOnCheckedChangeListener { view, isChecked ->
156156
if (isChecked && view != lastSelectedButton) {
157-
lastSelectedButton.isChecked = false
157+
lastSelectedButton?.isChecked = false
158158
lastSelectedButton = view
159159
viewModel.onCountrySelected(this.countryCode)
160160
}

0 commit comments

Comments
 (0)