Explorar el Código

Snoozer tab min ago crash fix

Jon Fawcett hace 4 años
padre
commit
abbde2867f
Se han modificado 1 ficheros con 9 adiciones y 5 borrados
  1. 9 5
      LoopFollow/Controllers/Timers.swift

+ 9 - 5
LoopFollow/Controllers/Timers.swift

@@ -61,15 +61,19 @@ extension MainViewController {
             latestMinAgoString = formattedDuration ?? ""
             latestMinAgoString += " min ago"
             
-            guard let snoozer = self.tabBarController!.viewControllers![2] as? SnoozeViewController else { return }
-            snoozer.MinAgoLabel.text = formattedDuration ?? ""
-            snoozer.MinAgoLabel.text! += " min ago"
+            if let snoozer = self.tabBarController!.viewControllers?[2] as? SnoozeViewController {
+                snoozer.MinAgoLabel.text = formattedDuration ?? ""
+                snoozer.MinAgoLabel.text! += " min ago"
+            } else { return }
+            
         } else {
             MinAgoText.text = ""
             latestMinAgoString = ""
             
-            guard let snoozer = self.tabBarController!.viewControllers?[2] as? SnoozeViewController else { return }
-            snoozer.MinAgoLabel.text = ""
+            if let snoozer = self.tabBarController!.viewControllers?[2] as? SnoozeViewController {
+                snoozer.MinAgoLabel.text = ""
+            } else { return }
+            
         }
         
     }