updated checks for ArgumentOutOfRangeException

internals
Zaafar 4 years ago committed by Eric Mellino
parent 5aae99ed9a
commit f7d49bcc38
  1. 4
      src/ImGui.NET/Util.cs

@ -37,7 +37,7 @@ namespace ImGuiNET
internal static int CalcSizeInUtf8(string s, int start, int length) internal static int CalcSizeInUtf8(string s, int start, int length)
{ {
if (start > s.Length - 1 || length > s.Length || start + length > s.Length) if (start < 0 || length < 0 || start + length > s.Length)
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }
@ -58,7 +58,7 @@ namespace ImGuiNET
internal static int GetUtf8(string s, int start, int length, byte* utf8Bytes, int utf8ByteCount) internal static int GetUtf8(string s, int start, int length, byte* utf8Bytes, int utf8ByteCount)
{ {
if (start > s.Length - 1 || length > s.Length || start + length > s.Length) if (start < 0 || length < 0 || start + length > s.Length)
{ {
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
} }

Loading…
Cancel
Save