From a86c7bea64cd01a2df94f96e8d9678c82906c443 Mon Sep 17 00:00:00 2001 From: Jim Chan Date: Sat, 27 Jan 2024 19:41:02 +0800 Subject: [PATCH] Lower bound check for G_IntString.ToStringNonAlloc See issue #112 --- Runtime/Util/G_Intstring.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Runtime/Util/G_Intstring.cs b/Runtime/Util/G_Intstring.cs index ef37bd5..ce71799 100644 --- a/Runtime/Util/G_Intstring.cs +++ b/Runtime/Util/G_Intstring.cs @@ -98,6 +98,11 @@ public static void Dispose() /// public static string ToStringNonAlloc( this int value ) { + if (value == int.MinValue) + { + return "N/A"; + } + if( value < 0 && -value <= m_negativeBuffer.Length ) { return m_negativeBuffer[ -value - 1 ];