KSPAPIExtensions icon indicating copy to clipboard operation
KSPAPIExtensions copied to clipboard

Fields with UI_FloatEdit but without guiFormat cause ArgumentExceptions in MathUtils.ToStringExt

Open toadicus opened this issue 10 years ago • 0 comments

https://github.com/Swamp-Ig/KSPAPIExtensions/blob/master/Source/Utils/MathUtils.cs#L99

If guiFormat is an empty string, this line will cause an ArgumentException: Index Out of Range.

It can be fixed by checking the string for non-zero length, thus:

if (format.Length > 0 && (format[0] == 'S' || format[0] == 's'))

HTH

toadicus avatar May 14 '15 18:05 toadicus