Skip to content

Commit

Permalink
Force unwrap replyBlock callback.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarkowsky committed Dec 4, 2024
1 parent c55eccb commit aacdd0e
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions Source/gui/SNTBinaryMessageWindowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -388,17 +388,22 @@ struct SNTBinaryMessageWindowView: View {
)
}

if let callback = self.replyCallback {
AuthorizeViaTouchID(
reason: msg,
replyBlock: { success in
callback(success)
DispatchQueue.main.sync {
window?.close()
}
// Force unwrap the callback because it should always be set and is a
// programming error if it isn't.
//
// Note: this may prevent other replyBlocks from being run, but should only
// crash the GUI process meaning policy decisions will still be enforced.
let callback = self.replyCallback!;

AuthorizeViaTouchID(
reason: msg,
replyBlock: { success in
callback(success)
DispatchQueue.main.sync {
window?.close()
}
)
}
}
)
}

func dismissButton() {
Expand Down

0 comments on commit aacdd0e

Please sign in to comment.