From bf222d2d396f2b36ee8ea513922246dce7944665 Mon Sep 17 00:00:00 2001 From: Tom Conkling Date: Fri, 9 May 2008 18:58:42 +0000 Subject: [PATCH] Properly handle StringUtil.parseInt("0", 0) git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5066 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/StringUtil.as | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/as/com/threerings/util/StringUtil.as b/src/as/com/threerings/util/StringUtil.as index cf31f06de..19550ce68 100644 --- a/src/as/com/threerings/util/StringUtil.as +++ b/src/as/com/threerings/util/StringUtil.as @@ -518,6 +518,12 @@ public class StringUtil str = str.substring(1); } + // handle this special case immediately, to prevent confusion about + // a leading 0 meaning "parse as octal" + if (str == "0") { + return 0; + } + if (radix == 0) { if (startsWith(str, "0x")) { str = str.substring(2);