Skip to content

Commit

Permalink
Made a bit safer
Browse files Browse the repository at this point in the history
  • Loading branch information
bartreardon committed May 26, 2023
1 parent 59db788 commit 2ca69ce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Outset/Functions/SystemUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ func oslogTypeToString(_ type: OSLogType) -> String {
func getConsoleUserInfo() -> (username: String, userID: String) {
// We need the console user, not the process owner so NSUserName() won't work for our needs when outset runs as root
var uid: uid_t = 0
let consoleUser = SCDynamicStoreCopyConsoleUser(nil, &uid, nil)! as String
return (consoleUser, "\(uid)")
if let consoleUser = SCDynamicStoreCopyConsoleUser(nil, &uid, nil) as? String {
return (consoleUser, "\(uid)")
} else {
return ("", "")
}
}

func writePreferences(prefs: OutsetPreferences) {
Expand Down

0 comments on commit 2ca69ce

Please sign in to comment.