8144915: TextField throws NPE

Reviewed-by: ssadetsky, serb
This commit is contained in:
Ambarish Rapte 2015-12-09 18:12:49 +03:00
parent 18ace0f732
commit f23d71b4f4

View File

@ -309,6 +309,9 @@ public class TextField extends TextComponent {
* @return Returns text after replacing EOL characters. * @return Returns text after replacing EOL characters.
*/ */
private static String replaceEOL(String text) { private static String replaceEOL(String text) {
if (text == null) {
return text;
}
String[] strEOLs = {System.lineSeparator(), "\n"}; String[] strEOLs = {System.lineSeparator(), "\n"};
for (String eol : strEOLs) { for (String eol : strEOLs) {
if (text.contains(eol)) { if (text.contains(eol)) {