Skip to content

Commit c7f9d54

Browse files
author
Dmitry Pentin
committed
Fixed string exif value corner case null ref exception
1 parent 7db4792 commit c7f9d54

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/ImageSharp/Metadata/Profiles/Exif/ExifEncodedStringHelpers.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,8 @@ public static int Write(EncodedString encodedString, Span<byte> destination)
7979
return CharacterCodeBytesLength + count;
8080
}
8181

82-
public static unsafe int Write(Encoding encoding, string value, Span<byte> destination)
83-
{
84-
fixed (char* c = value)
85-
{
86-
fixed (byte* b = destination)
87-
{
88-
return encoding.GetBytes(c, value.Length, b, destination.Length);
89-
}
90-
}
91-
}
82+
public static unsafe int Write(Encoding encoding, string value, Span<byte> destination) =>
83+
encoding.GetBytes(value.AsSpan(), destination);
9284

9385
private static bool TryDetect(ReadOnlySpan<byte> buffer, out CharacterCode code)
9486
{

0 commit comments

Comments
 (0)