Skip to content

Commit e0566fd

Browse files
committed
Fixed: Crash due to force unwrap option value
1 parent 2b7a332 commit e0566fd

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

ClashX/AppDelegate.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,21 +67,22 @@ class AppDelegate: NSObject, NSApplicationDelegate {
6767
ConfigManager.shared
6868
.showNetSpeedIndicatorObservable
6969
.bind {[unowned self] (show) in
70-
self.showNetSpeedIndicatorMenuItem.state = (show!) ? .on : .off
71-
self.statusItem = NSStatusBar.system.statusItem(withLength: show! ? 57 : 22)
70+
self.showNetSpeedIndicatorMenuItem.state = (show ?? true) ? .on : .off
71+
self.statusItem = NSStatusBar.system.statusItem(withLength: (show ?? true) ? 57 : 22)
7272
self.statusItem.view = self.statusItemView
73-
self.statusItemView.showSpeedContainer(show: show!)
73+
self.statusItemView.showSpeedContainer(show: (show ?? true))
7474
self.statusItemView.statusItem = self.statusItem
7575
}.disposed(by: disposeBag)
7676

7777
ConfigManager.shared
7878
.proxyPortAutoSetObservable
7979
.distinctUntilChanged()
8080
.bind{ [unowned self]
81-
enable in
82-
self.proxySettingMenuItem.state = (enable ?? false) ? .on : .off
81+
en in
82+
let enable = en ?? false
83+
self.proxySettingMenuItem.state = enable ? .on : .off
8384
let image =
84-
NSImage(named: NSImage.Name(rawValue: "menu_icon"))!.tint(color: enable! ? NSColor.black : NSColor.gray)
85+
NSImage(named: NSImage.Name(rawValue: "menu_icon"))!.tint(color: enable ? NSColor.black : NSColor.gray)
8586
((self.statusItem.view) as! StatusItemView).imageView.image = image
8687
}.disposed(by: disposeBag)
8788

ClashX/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>1.0</string>
2121
<key>CFBundleVersion</key>
22-
<string>1.0</string>
22+
<string>1.1</string>
2323
<key>LSMinimumSystemVersion</key>
2424
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
2525
<key>LSUIElement</key>

0 commit comments

Comments
 (0)