Skip to content

Commit

Permalink
fix: Handle empty dict in TimeMachine check for related checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Feb 5, 2025
1 parent 3878ed1 commit cd27afc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Pareto/Checks/System Integrity/TimeMachine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TimeMachineCheck: ParetoCheck {
}

override public var isRunnable: Bool {
guard let config = readDefaultsFile(path: "/Library/Preferences/com.apple.TimeMachine.plist") as? [String: Any] else {
guard readDefaultsFile(path: "/Library/Preferences/com.apple.TimeMachine.plist") is [String: Any] else {
return false
}
return config.count > 1 && isActive

Check failure on line 37 in Pareto/Checks/System Integrity/TimeMachine.swift

View workflow job for this annotation

GitHub Actions / Build and Archive SetApp

cannot find 'config' in scope

Check failure on line 37 in Pareto/Checks/System Integrity/TimeMachine.swift

View workflow job for this annotation

GitHub Actions / Build and Archive Native

cannot find 'config' in scope
Expand Down
11 changes: 10 additions & 1 deletion Pareto/Checks/System Integrity/TimeMachineIsEncrypted.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,16 @@ class TimeMachineIsEncryptedCheck: ParetoCheck {
}

override public var isRunnable: Bool {
return TimeMachineCheck.sharedInstance.isRunnable && isActive
if TimeMachineCheck.sharedInstance.isRunnable && isActive {
let dict = readDefaultsFile(path: "/Library/Preferences/com.apple.TimeMachine.plist") as! [String: Any]?
guard let settings = dict else {
return false
}
let tmConf = TimeMachineConfig(dict: settings)
return tmConf.canCheckIsEncryptedBackup
}

return false
}

override public var showSettings: Bool {
Expand Down
2 changes: 1 addition & 1 deletion Pareto/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>5538</string>
<string>5539</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit cd27afc

Please sign in to comment.