Ticket #21279: 21279.patch

File 21279.patch, 1.5 KB (added by marcello@…, 5 years ago)
  • src/org/openstreetmap/josm/gui/tagging/ac/AutoCompComboBox.java

     
    104104        @Override
    105105        public void insertString(FilterBypass fb, int offset, String string, AttributeSet attr)
    106106                throws BadLocationException {
    107             int newLen = fb.getDocument().getLength() + string.length();
     107            int newLen = fb.getDocument().getLength() + ((string == null) ? 0 : string.length());
    108108            if (maxTextLength == -1 || newLen <= maxTextLength ||
    109109                    // allow longer text while composing characters or it will be hard to compose
    110110                    // the last characters before the limit
     
    116116        @Override
    117117        public void replace(FilterBypass fb, int offset, int length, String string, AttributeSet attr)
    118118                throws BadLocationException {
    119             int newLen = fb.getDocument().getLength() - length + string.length();
     119            int newLen = fb.getDocument().getLength() - length + ((string == null) ? 0 : string.length());
    120120            if (maxTextLength == -1 || newLen <= maxTextLength ||
    121121                    // allow longer text while composing characters or it will be hard to compose
    122122                    // the last characters before the limit