mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-03 23:58:55 +01:00 
			
		
		
		
	Avoid potential crash when opening library settings sheet 2.0 (#9419)
Avoid potential crash when opening library settings sheet 2.0 Previous one had issues
This commit is contained in:
		@@ -205,11 +205,18 @@ object LibraryTab : Tab {
 | 
			
		||||
 | 
			
		||||
        val onDismissRequest = screenModel::closeDialog
 | 
			
		||||
        when (val dialog = state.dialog) {
 | 
			
		||||
            is LibraryScreenModel.Dialog.SettingsSheet -> LibrarySettingsDialog(
 | 
			
		||||
                onDismissRequest = onDismissRequest,
 | 
			
		||||
                screenModel = settingsScreenModel,
 | 
			
		||||
                category = state.categories[screenModel.activeCategoryIndex],
 | 
			
		||||
            )
 | 
			
		||||
            is LibraryScreenModel.Dialog.SettingsSheet -> run {
 | 
			
		||||
                val category = state.categories.getOrNull(screenModel.activeCategoryIndex)
 | 
			
		||||
                if (category == null) {
 | 
			
		||||
                    onDismissRequest()
 | 
			
		||||
                    return@run
 | 
			
		||||
                }
 | 
			
		||||
                LibrarySettingsDialog(
 | 
			
		||||
                    onDismissRequest = onDismissRequest,
 | 
			
		||||
                    screenModel = settingsScreenModel,
 | 
			
		||||
                    category = category,
 | 
			
		||||
                )
 | 
			
		||||
            }
 | 
			
		||||
            is LibraryScreenModel.Dialog.ChangeCategory -> {
 | 
			
		||||
                ChangeCategoryDialog(
 | 
			
		||||
                    initialSelection = dialog.initialSelection,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user