Ignore:
Timestamp:
2007-04-04T11:31:50+02:00 (17 years ago)
Author:
imi
Message:
  • fixed a NPE when hitting a mapmode shortcut after all layers have been closed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/MapFrame.java

    r205 r208  
    3333import org.openstreetmap.josm.gui.dialogs.SelectionListDialog;
    3434import org.openstreetmap.josm.gui.dialogs.ToggleDialog;
     35import org.openstreetmap.josm.tools.Destroyable;
    3536
    3637/**
     
    4041 * @author imi
    4142 */
    42 public class MapFrame extends JPanel {
     43public class MapFrame extends JPanel implements Destroyable {
    4344
    4445        /**
     
    135136        }
    136137
     138        /**
     139         * Called as some kind of destructor when the last layer has been removed.
     140         * Delegates the call to all Destroyables within this component (e.g. MapModes)
     141         */
     142        public void destroy() {
     143                for (int i = 0; i < toolBarActions.getComponentCount(); ++i)
     144                        if (toolBarActions.getComponent(i) instanceof Destroyable)
     145                                ((Destroyable)toolBarActions).destroy();
     146    }
     147
    137148        public Action getDefaultButtonAction() {
    138149                return ((AbstractButton)toolBarActions.getComponent(0)).getAction();
Note: See TracChangeset for help on using the changeset viewer.