Skip to content

Commit

Permalink
[fix]: filters loglevel crash
Browse files Browse the repository at this point in the history
  • Loading branch information
F0x1d committed Nov 9, 2024
1 parent e905261 commit dd4d55d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.f0x1d.logfox.feature.filters.edit.presentation

import com.f0x1d.logfox.database.entity.UserFilter
import com.f0x1d.logfox.model.logline.LogLevel

data class EditFilterState(
val filter: UserFilter? = null,
val including: Boolean = true,
val enabledLogLevels: List<Boolean> = emptyList(),
val enabledLogLevels: List<Boolean> = List(LogLevel.entries.size) { false },
)
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class EditFilterViewModel @Inject constructor(
.collect { filter ->
if (filter == null) return@collect

val enabledLogLevels = List(7) { false }.toMutableList()
val enabledLogLevels = List(LogLevel.entries.size) { false }.toMutableList()
val allowedLevels = filter.allowedLevels.map { it.ordinal }
for (i in 0 until enabledLogLevels.size) {
enabledLogLevels[i] = allowedLevels.contains(i)
Expand Down

0 comments on commit dd4d55d

Please sign in to comment.