mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2024-11-10 01:01:56 +01:00
fix: option state crash (#1456)
Co-authored-by: Ax333l <main@axelen.xyz>
This commit is contained in:
parent
8df7f2992d
commit
5fff0a2923
1 changed files with 3 additions and 2 deletions
|
@ -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 a new issue