소스 검색

Snoozer tab min ago crash fix

Jon Fawcett 4 년 전
부모
커밋
abbde2867f
1개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  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 }
+            
         }
         
     }