Skip to content

Commit

Permalink
Fixed false-positive with StrPtrAuto.IsNullOrEmpty (#455)
Browse files Browse the repository at this point in the history
  • Loading branch information
dahall committed Apr 23, 2024
1 parent 831d40e commit a0bf0b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Core/InteropServices/StrPtr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public struct StrPtrAuto : IEquatable<string>, IEquatable<StrPtrAuto>, IEquatabl
/// <returns>
/// <see langword="true"/> if the value parameter is <see langword="null"/> or an empty string (""); otherwise, <see langword="false"/>.
/// </returns>
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;

/// <summary>Performs an implicit conversion from <see cref="StrPtrAuto"/> to <see cref="string"/>.</summary>
/// <param name="p">The <see cref="StrPtrAuto"/> instance.</param>
Expand Down

0 comments on commit a0bf0b3

Please sign in to comment.