Changeset 2159 in josm for trunk/src


Ignore:
Timestamp:
2009-09-19T10:55:26+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3539: NullPointerException when deleting the only data layer from the context menu

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

    r2039 r2159  
    88import java.awt.GridLayout;
    99import java.awt.Point;
     10import java.awt.Rectangle;
    1011import java.awt.event.ActionEvent;
    1112import java.awt.event.KeyEvent;
     
    1819import java.util.List;
    1920import java.util.concurrent.CopyOnWriteArrayList;
    20 import java.util.logging.Logger;
    2121
    2222import javax.swing.AbstractAction;
     
    2828import javax.swing.JLabel;
    2929import javax.swing.JList;
    30 import javax.swing.JOptionPane;
    3130import javax.swing.JPanel;
    3231import javax.swing.JScrollPane;
     
    4241import org.openstreetmap.josm.Main;
    4342import org.openstreetmap.josm.actions.MergeLayerAction;
    44 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    45 import org.openstreetmap.josm.gui.ExtendedDialog;
    4643import org.openstreetmap.josm.gui.MapFrame;
    4744import org.openstreetmap.josm.gui.MapView;
     
    5754/**
    5855 * This is a toggle dialog which displays the list of layers. Actions allow to
    59  * change the ordering the layer, to hide/show layers, to activate layers
     56 * change the ordering of the layers, to hide/show layers, to activate layers,
    6057 * and to delete layers.
    6158 *
     
    317314                dialog.setVisible(true);
    318315                switch(dialog.getUserAction()) {
    319                 case CANCEL: return false;
    320                 case PROCEED: return true;
    321                 default: return false;
     316                    case CANCEL: return false;
     317                    case PROCEED: return true;
     318                    default: return false;
    322319                }
    323320            }
     
    10311028        protected void processMouseEvent(MouseEvent e) {
    10321029            // if the layer list is embedded in a detached dialog, the last row is
    1033             // is selected if a user clicks in the empty space *below* the last row.
     1030            // selected if a user clicks in the empty space *below* the last row.
    10341031            // This mouse event filter prevents this.
    10351032            //
    10361033            int idx = locationToIndex(e.getPoint());
    1037             if (getCellBounds(idx, idx).contains(e.getPoint())) {
     1034            // sometimes bounds can be null, see #3539
     1035            Rectangle bounds = getCellBounds(idx,idx);
     1036            if (bounds != null && bounds.contains(e.getPoint())) {
    10381037                super.processMouseEvent(e);
    10391038            }
Note: See TracChangeset for help on using the changeset viewer.