You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lo...@apache.org on 2023/08/28 17:47:54 UTC

[beam] 11/22: Trying to stop advanced(by:) crashes on non-macOS platforms

This is an automated email from the ASF dual-hosted git repository.

lostluck pushed a commit to branch swift-sdk
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 02b0ae54ca718f6eceef80025e62cd7e4627061c
Author: Byron Ellis <by...@google.com>
AuthorDate: Thu Aug 17 13:10:04 2023 -0700

    Trying to stop advanced(by:) crashes on non-macOS platforms
---
 sdks/swift/Sources/ApacheBeam/Internal/Data+Decoding.swift | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sdks/swift/Sources/ApacheBeam/Internal/Data+Decoding.swift b/sdks/swift/Sources/ApacheBeam/Internal/Data+Decoding.swift
index d2c3637e9f8..d8b3c7ef53a 100644
--- a/sdks/swift/Sources/ApacheBeam/Internal/Data+Decoding.swift
+++ b/sdks/swift/Sources/ApacheBeam/Internal/Data+Decoding.swift
@@ -47,7 +47,12 @@ extension Data {
                 }
             }
         }
+        // On non-macOS platforms this crashes due to differences in Foundation implementations
+        #if os(macOS)
+        self = self.advanced(by: advance)
+        #else
         self = advance == count ? Data() : self.advanced(by: advance)
+        #endif
         return result
     }