Skip to content

Commit 6469433

Browse files
committed
Work around memset taking a non-optional pointer on Linux
1 parent c0e8ef3 commit 6469433

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/System/Internals/Exports.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ internal func system_memset(
8787
_ buffer: UnsafeMutableRawBufferPointer,
8888
to byte: UInt8
8989
) {
90-
memset(buffer.baseAddress, CInt(byte), buffer.count)
90+
guard buffer.count > 0 else { return }
91+
memset(buffer.baseAddress!, CInt(byte), buffer.count)
9192
}
9293

9394
// Interop between String and platfrom string

0 commit comments

Comments
 (0)