< prev index next >

src/java.desktop/share/classes/java/awt/TextField.java

Print this page

        

@@ -307,10 +307,13 @@
      * Replaces EOL characters from the text variable with a space character.
      * @param       text   the new text.
      * @return      Returns text after replacing EOL characters.
      */
     private static String replaceEOL(String text) {
+        if (text == null) {
+            return text;
+        }
         String[] strEOLs = {System.lineSeparator(), "\n"};
         for (String eol : strEOLs) {
             if (text.contains(eol)) {
                 text = text.replace(eol, " ");
             }
< prev index next >