fix: Solve crash with a single shakemape curve
This commit is contained in:
+5
-1
@@ -199,7 +199,11 @@ class SeismicNetworksIntensityMapViewController: EQNBaseMapViewController {
|
||||
|
||||
let minIntensity = shakemaps.map { $0.intensity }.min() ?? 0
|
||||
let maxIntensity = shakemaps.map { $0.intensity }.max() ?? 255
|
||||
let indexColor = Int(round((intensity-minIntensity)/(maxIntensity-minIntensity)*255))
|
||||
let indexColor = if minIntensity == maxIntensity {
|
||||
0
|
||||
} else {
|
||||
Int(round((intensity-minIntensity)/(maxIntensity-minIntensity)*255))
|
||||
}
|
||||
|
||||
let lineColor = UIColor(hexString: shakemapColors[indexColor]) ?? .white
|
||||
let textColor: UIColor = indexColor < 65 ? .white : .black
|
||||
|
||||
Reference in New Issue
Block a user