mirror of
https://github.com/gosticks/SwiftGit2.git
synced 2025-10-16 11:55:34 +00:00
Use optional binding instead of comparing to nil and force-unwrapping
This commit is contained in:
parent
6244bdfdc6
commit
160428039e
@ -15,8 +15,8 @@ public typealias CheckoutProgressBlock = (String?, Int, Int) -> Void
|
||||
/// Helper function used as the libgit2 progress callback in git_checkout_options.
|
||||
/// This is a function with a type signature of git_checkout_progress_cb.
|
||||
private func checkoutProgressCallback(path: UnsafePointer<Int8>?, completed_steps: Int, total_steps: Int, payload: UnsafeMutableRawPointer?) -> Void {
|
||||
if (payload != nil) {
|
||||
let buffer = payload!.assumingMemoryBound(to: CheckoutProgressBlock.self)
|
||||
if let payload = payload {
|
||||
let buffer = payload.assumingMemoryBound(to: CheckoutProgressBlock.self)
|
||||
let block: CheckoutProgressBlock
|
||||
if completed_steps < total_steps {
|
||||
block = buffer.pointee
|
||||
|
||||
Loading…
Reference in New Issue
Block a user