We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 28ce250 commit a2d2beeCopy full SHA for a2d2bee
1 file changed
Plugins/RedisDriverPlugin/RedisPluginConnection.swift
@@ -577,9 +577,11 @@ private extension RedisPluginConnection {
577
let cStrings: [UnsafeMutablePointer<CChar>] = args.map { arg in
578
let utf8 = Array(arg.utf8)
579
let ptr = UnsafeMutablePointer<CChar>.allocate(capacity: utf8.count + 1)
580
- if let base = utf8.withUnsafeBufferPointer({ $0.baseAddress }) {
581
- base.withMemoryRebound(to: CChar.self, capacity: utf8.count) { src in
582
- ptr.initialize(from: src, count: utf8.count)
+ utf8.withUnsafeBufferPointer { buffer in
+ if let base = buffer.baseAddress {
+ base.withMemoryRebound(to: CChar.self, capacity: utf8.count) { src in
583
+ ptr.initialize(from: src, count: utf8.count)
584
+ }
585
}
586
587
ptr[utf8.count] = 0
0 commit comments