Ignore:
Timestamp:
2017-06-01T01:20:37+02:00 (4 years ago)
Author:
Don-vip
Message:

sonar - squid:S3516 - Methods returns should not be invariant

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java

    r10663 r12288  
    4848    @Override
    4949    public boolean executeCommand() {
    50         if (position < 0 || position >= relation.getMembersCount())
    51             return true;
    52 
    53         oldRole = relation.getMember(position).getRole();
    54         if (newRole.equals(oldRole)) return true;
    55         relation.setMember(position, new RelationMember(newRole, relation.getMember(position).getMember()));
    56 
    57         oldModified = relation.isModified();
    58         relation.setModified(true);
     50        if (position >= 0 && position < relation.getMembersCount()) {
     51            oldRole = relation.getMember(position).getRole();
     52            if (!newRole.equals(oldRole)) {
     53                relation.setMember(position, new RelationMember(newRole, relation.getMember(position).getMember()));
     54                oldModified = relation.isModified();
     55                relation.setModified(true);
     56            }
     57        }
    5958        return true;
    6059    }
Note: See TracChangeset for help on using the changeset viewer.