diff --git a/LunaMac/AppDelegate.swift b/LunaMac/AppDelegate.swift
index cbbbad9..a364b67 100644
--- a/LunaMac/AppDelegate.swift
+++ b/LunaMac/AppDelegate.swift
@@ -243,10 +243,16 @@ class AppDelegate: NSObject, NSApplicationDelegate {
var newArr = [String:[String:NSString]]()
- newArr = phaseArray.filter{findPhase(key: $0.key, val: $0.value, start: $0.value["start"]?.doubleValue ?? 0, end: $0.value["end"]?.doubleValue ?? 0, curr: currDays)}
+ newArr = phaseArray.filter{
+ findPhase(
+ start: $0.value["start"]?.doubleValue ?? 0,
+ end: $0.value["end"]?.doubleValue ?? 0,
+ curr: currDays
+ )
+ }
// we want newArr[0].value which is [String:NSString]
- let theKey = newArr.first!.key
+ let theKey = newArr.first?.key ?? "default"
buildMenu(key: theKey)
} else {
// if dateDiff is negative, something went wrong.
@@ -254,7 +260,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
}
- @objc func findPhase(key: String, val: [String:NSString], start: Double, end: Double, curr: Double) -> Bool {
+ @objc func findPhase(start: Double, end: Double, curr: Double) -> Bool {
if ((curr >= start) && (curr <= end)) {
return true
diff --git a/LunaMac/Base.lproj/MainMenu.xib b/LunaMac/Base.lproj/MainMenu.xib
index 8970279..591d304 100644
--- a/LunaMac/Base.lproj/MainMenu.xib
+++ b/LunaMac/Base.lproj/MainMenu.xib
@@ -10,7 +10,7 @@
-
+
diff --git a/LunaMac/Changelog.xib b/LunaMac/Changelog.xib
index 4e9ea31..df937de 100644
--- a/LunaMac/Changelog.xib
+++ b/LunaMac/Changelog.xib
@@ -9,7 +9,7 @@
-
+
diff --git a/LunaMac/InfoBox.xib b/LunaMac/InfoBox.xib
index c6edb68..a049504 100644
--- a/LunaMac/InfoBox.xib
+++ b/LunaMac/InfoBox.xib
@@ -28,21 +28,21 @@
-
-
+
+
-
-
- LunaMac calculates the current moon phase when it launches. If you see a ⨂ instead of a moon phase, try again from the status bar icon's menu.
+
+
-
-
+
+
-
-
+
+
+ LunaMac calculates the current moon phase by your system clock (UTC). If you see a ⨂ instead of a moon phase, try again from the status bar icon's menu.
diff --git a/LunaMac/ViewController.swift b/LunaMac/ViewController.swift
index 55af6c3..9ff4fe6 100644
--- a/LunaMac/ViewController.swift
+++ b/LunaMac/ViewController.swift
@@ -14,8 +14,6 @@ class ViewController: NSViewController, NSWindowDelegate {
@IBOutlet var textView: NSTextView!
-
-
override func viewDidLoad() {
super.viewDidLoad()
@@ -30,7 +28,7 @@ class ViewController: NSViewController, NSWindowDelegate {
// get log file path
let logPath = Bundle.main.path(forResource: "changelog.txt", ofType: nil)!
// get contents of log file
- let logText = try! String(contentsOfFile: logPath, encoding: String.Encoding.utf8)
+ let logText = (try? String(contentsOfFile: logPath, encoding: String.Encoding.utf8)) ?? "Changelog couldn't be read."
// create an object to hold the text and its formatting
let textStorage = NSTextStorage(string: logText)