diff --git a/Source/AwsCommonRuntimeKit/crt/Utilities.swift b/Source/AwsCommonRuntimeKit/crt/Utilities.swift index 09a96c632..f37527338 100644 --- a/Source/AwsCommonRuntimeKit/crt/Utilities.swift +++ b/Source/AwsCommonRuntimeKit/crt/Utilities.swift @@ -130,13 +130,13 @@ extension aws_byte_cursor { } let data = Data(bytesNoCopy: self.ptr, count: self.len, deallocator: .none) - return String(data: data, encoding: .utf8)! + return String(decoding: data, as: UTF8.self) } func toOptionalString() -> String? { if self.len == 0 { return nil } let data = Data(bytesNoCopy: self.ptr, count: self.len, deallocator: .none) - return String(data: data, encoding: .utf8)! + return String(data: data, encoding: .utf8) } }