mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: option state crash (#1456)
Co-authored-by: Ax333l <main@axelen.xyz>
This commit is contained in:
parent
8df7f2992d
commit
5fff0a2923
@ -59,10 +59,11 @@ class SelectedAppInfoViewModel(input: Params) : ViewModel(), KoinComponent {
|
||||
var options: Options by savedStateHandle.saveable {
|
||||
val state = mutableStateOf<Options>(emptyMap())
|
||||
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
viewModelScope.launch {
|
||||
if (!persistConfiguration) return@launch // TODO: save options for patched apps.
|
||||
|
||||
state.value = optionsRepository.getOptions(selectedApp.packageName)
|
||||
val packageName = selectedApp.packageName // Accessing this from another thread may cause crashes.
|
||||
state.value = withContext(Dispatchers.Default) { optionsRepository.getOptions(packageName) }
|
||||
}
|
||||
|
||||
state
|
||||
|
Loading…
Reference in New Issue
Block a user