Ignore:
Timestamp:
2024-02-27T07:26:35+01:00 (9 months ago)
Author:
GerdP
Message:

fix #23515: IllegalArgumentException in Relation Toolbox after undo

  • add check if relation is still in dataset
  • fix some sonarlimt / checkstyle issues
File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/reltoolbox/src/relcontext/ChosenRelation.java

    r36102 r36213  
    4141 */
    4242public class ChosenRelation implements ActiveLayerChangeListener, MapViewPaintable, DataSetListener {
    43     protected Relation chosenRelation = null;
     43    protected Relation chosenRelation;
    4444    private final Set<ChosenRelationListener> chosenRelationListeners = new HashSet<>();
    4545
     
    162162            for (OsmPrimitive element : rel.getMemberPrimitives()) {
    163163                if (null != element.getType()) {
    164                     switch(element.getType()) {
     164                    switch (element.getType()) {
    165165                    case NODE:
    166166                        Node node = (Node) element;
     
    212212    public void dataChanged(DataChangedEvent event) {
    213213        if (chosenRelation != null) {
    214             fireRelationChanged(chosenRelation);
     214            if (chosenRelation.getDataSet() == null)
     215                clear();
     216            else
     217                fireRelationChanged(chosenRelation);
    215218        }
    216219    }
Note: See TracChangeset for help on using the changeset viewer.