In my project I'm getting a lot of crashes for
QuartzCore CA::Layer::set_bounds(CA::Rect const&, bool)
From Fabric I get the following message.
Heads Up! CALayerInvalidGeometry; CALayer bounds contains NaN: [...] Details: This crash is likely due to a division by zero when applying a transform to a view or layer. Setting the 'CG_NUMERICS_SHOW_BACKTRACE' environment variable in Xcode can help pinpoint the root cause. Check out the references below for more details. External resources: Crash occurring because “CALayer bounds contains NaN: [nan 0; nan 15.1] 'CALayerInvalidGeometry', reason: 'CALayer bounds contains NaN' exception Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]' #15
How can I solve this crash problem?
Below I share the screenshot of the crash I got from Fabric.

Below I share the class of the UserDefaults-AppLocale.swift in my project.
extension UserDefaults {
private enum Key : String {
case languageCode = "LanguageCode"
case regionCode = "RegionCode"
}
static var languageCode: String? {
get {
let defs = UserDefaults.standard
return defs.string(forKey: Key.languageCode.rawValue)
}
set(value) {
let defs = UserDefaults.standard
if let value = value {
defs.set(value, forKey: Key.languageCode.rawValue)
return
}
defs.removeObject(forKey: Key.languageCode.rawValue) // Line 29
}
}
static var regionCode: String? {
get {
let defs = UserDefaults.standard
return defs.string(forKey: Key.regionCode.rawValue)
}
set(value) {
let defs = UserDefaults.standard
if let value = value {
defs.set(value, forKey: Key.regionCode.rawValue)
return
}
defs.removeObject(forKey: Key.regionCode.rawValue)
}
}
}
It's line 29 on this Fabric.
defs.removeObject(forKey: Key.languageCode.rawValue)