Skip to content

Commit

Permalink
Log when font size index to understand why it crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamede1945 committed Nov 20, 2023
1 parent 10025db commit 1fa0ad6
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Localization
import QuranText
import SwiftUI
import UIx
import VLogging

struct MoreMenuFontSize: View {
// MARK: Internal
Expand Down Expand Up @@ -39,7 +40,13 @@ struct MoreMenuFontSize: View {

private var fontIndex: Binding<Int> {
Binding(
get: { fonts.firstIndex(of: fontSize)! },
get: {
let index = fonts.firstIndex(of: fontSize)
if index == nil {
logger.error("Couldn't find \(fontSize) in \(fonts)")
}
return index!
},
set: { fontSize = fonts[$0] }
)
}
Expand Down

0 comments on commit 1fa0ad6

Please sign in to comment.