Skip to content

Commit

Permalink
protect against NPE per spotbugs report
Browse files Browse the repository at this point in the history
  • Loading branch information
devel-bobm committed Sep 28, 2018
1 parent 9f49ace commit a388d55
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions java/src/jmri/jmrix/loconet/LnPowerManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Inc for separate permission.
*
* @author Bob Jacobsen Copyright (C) 2001
* @author B. Milhaupt Copyright (C)
* @author B. Milhaupt Copyright (C)
*/
public class LnPowerManager
extends jmri.managers.AbstractPowerManager
Expand All @@ -35,7 +35,7 @@ public LnPowerManager(LocoNetSystemConnectionMemo memo) {
}

protected int power = UNKNOWN;

@Override
public void setPower(int v) throws JmriException {
power = UNKNOWN;
Expand Down Expand Up @@ -234,9 +234,11 @@ public boolean implementsIdle() {
boolean supportsIdleState = false;
if (tc == null) {
log.error("TC is null in LnPowerManager");
return false;
}
if (tc.memo == null) {
log.error("TC.Memo is null in LnPowerManager");
return false;
}
LnCommandStationType cmdStationType = tc.memo.getSlotManager().getCommandStationType();
switch (cmdStationType) {
Expand All @@ -249,7 +251,7 @@ public boolean implementsIdle() {
break;
default:
supportsIdleState = false;

}
return supportsIdleState;
}
Expand Down

0 comments on commit a388d55

Please sign in to comment.