EA-34240 - SIOOBE: CompileTimeConstantResolver.getCharValue

This commit is contained in:
Andrey Breslav
2012-03-12 16:57:43 +04:00
parent b4e2a5fb30
commit c315734665
2 changed files with 15 additions and 2 deletions
@@ -182,11 +182,11 @@ public class CompileTimeConstantResolver {
}
// Strip the quotes
if (text.charAt(0) != '\'' || text.charAt(text.length() - 1) != '\'') {
if (text.length() < 2 || text.charAt(0) != '\'' || text.charAt(text.length() - 1) != '\'') {
return new ErrorValue("Incorrect character literal");
}
text = text.substring(1, text.length() - 1); // now there're no quotes
if (text.length() == 0) {
return new ErrorValue("Empty character literal");
}