diff --git a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java index b1bc38b64be0efeffb3e466b46e68d2618ff880c..589957931b9e004908c86a8c8e179fa72438065d 100644 --- a/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java +++ b/com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RRuntime.java @@ -361,6 +361,9 @@ public class RRuntime { @TruffleBoundary public static int parseInt(String s) { int length = s.length(); + if (length == 0) { + throw new NumberFormatException(); + } long value = 0; if (s.charAt(0) == '-') { if (length == 1) { @@ -379,9 +382,6 @@ public class RRuntime { } return (int) -value; } else { - if (length == 0) { - throw new NumberFormatException(); - } int pos = 0; while (pos < length) { char ch = s.charAt(pos++); @@ -400,6 +400,9 @@ public class RRuntime { @TruffleBoundary public static int parseIntWithNA(String s) { int length = s.length(); + if (length == 0) { + return INT_NA; + } long value = 0; if (s.charAt(0) == '-') { if (length == 1) { @@ -418,9 +421,6 @@ public class RRuntime { } return (int) -value; } else { - if (length == 0) { - return INT_NA; - } int pos = 0; while (pos < length) { char ch = s.charAt(pos++);