mirror of
https://github.com/godotengine/godot.git
synced 2025-12-07 22:00:10 +00:00
change AsSpan to use a range from "from" to "end"
the current code assumes that float.Parse behaves the same as the internal C++ code, however without using "end" as part of the span, it will parse from index 0 to the end of the string, ignoring commas. for example, this causes it to parse "0,5,0" with divisor "," as [50, 50, 0], as the float.Parse method ignores commas in floats. if another divisor is used, it throws a System.FormatException due to containing invalid characters, as it fails to account for the position of the divisor for the span.
This commit is contained in:
parent
68410acc61
commit
b5591bf5f6
1 changed files with 1 additions and 1 deletions
|
|
@ -1539,7 +1539,7 @@ namespace Godot
|
||||||
if (end < 0)
|
if (end < 0)
|
||||||
end = len;
|
end = len;
|
||||||
if (allowEmpty || end > from)
|
if (allowEmpty || end > from)
|
||||||
ret.Add(float.Parse(instance.AsSpan(from), CultureInfo.InvariantCulture));
|
ret.Add(float.Parse(instance.AsSpan(from, end - from), CultureInfo.InvariantCulture));
|
||||||
if (end == len)
|
if (end == len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue