From a0bf0b31649f498fc5cb7be5ef6d1aae06cf8142 Mon Sep 17 00:00:00 2001 From: David Hall Date: Tue, 23 Apr 2024 08:21:01 -0600 Subject: [PATCH] Fixed false-positive with StrPtrAuto.IsNullOrEmpty (#455) --- Core/InteropServices/StrPtr.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/InteropServices/StrPtr.cs b/Core/InteropServices/StrPtr.cs index cc63c7fc1..0fa68a662 100644 --- a/Core/InteropServices/StrPtr.cs +++ b/Core/InteropServices/StrPtr.cs @@ -250,7 +250,7 @@ public struct StrPtrAuto : IEquatable, IEquatable, IEquatabl /// /// if the value parameter is or an empty string (""); otherwise, . /// - public bool IsNullOrEmpty => ptr == IntPtr.Zero || StringHelper.GetString(ptr, CharSet.Auto, 1) == string.Empty; + public bool IsNullOrEmpty => ptr == IntPtr.Zero || Marshal.SystemDefaultCharSize == 2 ? Marshal.ReadInt16(ptr) == 0 : Marshal.ReadByte(ptr) == 0; /// Performs an implicit conversion from to . /// The instance.