Skip to content

Commit

Permalink
Fix call to NSLog when logging
Browse files Browse the repository at this point in the history
Calling `NSLog(message!)` will interpret message as format string (see
[docs](https://developer.apple.com/documentation/foundation/1395275-nslog),
causing errors and even segfault in some edge cases. Instead, use proper
format string  and message as argument.

Fixes johnste#328.
  • Loading branch information
sergei-dyshel committed May 15, 2024
1 parent 33e1248 commit 23b2279
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Finicky/Finicky/API.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import JavaScriptCore

static func log(_ message: String?) {
if message != nil {
NSLog(message!)
NSLog("%@", message!)
logToConsole?(message!, false)
}
}
Expand Down

0 comments on commit 23b2279

Please sign in to comment.