diff options
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs b/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs index 8cae6a238d..baea0df8cc 100644 --- a/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs +++ b/MediaBrowser.MediaEncoding/Encoder/ApplePlatformHelper.cs @@ -37,7 +37,12 @@ public static partial class ApplePlatformHelper throw new NotSupportedException($"Failed to get sysctl value for {name} with error {osStatus}"); } - ReadOnlySpan<byte> data = buffer.AsSpan()[..(int)length]; + if (length < 1) + { + return string.Empty; + } + + ReadOnlySpan<byte> data = buffer.AsSpan()[..(int)(length - 1)]; return Encoding.UTF8.GetString(data); } finally |
