Changeset 6017 in josm for trunk


Ignore:
Timestamp:
2013-06-24T12:54:26+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #8818 - NPE in JosmComboBox

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java

    r5886 r6017  
    1515
    1616import javax.accessibility.Accessible;
     17import javax.swing.ComboBoxEditor;
    1718import javax.swing.ComboBoxModel;
    1819import javax.swing.DefaultComboBoxModel;
     
    218219        private void enableMenu() {
    219220            if (launcher == null) {
    220                 Component editorComponent = getEditor().getEditorComponent();
    221                 if (editorComponent instanceof JTextComponent) {
    222                     component = (JTextComponent) editorComponent;
    223                     component.addMouseListener(this);
    224                     launcher = TextContextualPopupMenu.enableMenuFor(component);
     221                ComboBoxEditor editor = getEditor();
     222                if (editor != null) {
     223                    Component editorComponent = editor.getEditorComponent();
     224                    if (editorComponent instanceof JTextComponent) {
     225                        component = (JTextComponent) editorComponent;
     226                        component.addMouseListener(this);
     227                        launcher = TextContextualPopupMenu.enableMenuFor(component);
     228                    }
    225229                }
    226230            }
Note: See TracChangeset for help on using the changeset viewer.