Skip to content

Commit

Permalink
[draytonwiser] Remove possibility of returning a null state for boost…
Browse files Browse the repository at this point in the history
… duration

Signed-off-by: Andrew Schofield <the.uncle.fungus@gmail.com>
  • Loading branch information
andrew-schofield committed Jul 14, 2020
1 parent 37ff7fe commit fe35575
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ private State getBoostRemainingState() {
final Integer overrideTimeout = firstChannel.getOverrideTimeoutUnixTime();

if (overrideTimeout != null && !"NONE".equalsIgnoreCase(firstChannel.getOverrideType())) {
return new QuantityType<Time>(overrideTimeout - (System.currentTimeMillis() / 1000L), SmartHomeUnits.SECOND).toUnit(SmartHomeUnits.MINUTE);
final QuantityType<Time> duration = new QuantityType<Time>(overrideTimeout - (System.currentTimeMillis() / 1000L), SmartHomeUnits.SECOND).toUnit(SmartHomeUnits.MINUTE);
if (duration != null)
{
return duration;
}
}
}
return new QuantityType<Time>(0, SmartHomeUnits.MINUTE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ private State getBoostedState() {
private State getBoostRemainingState() {
final Integer overrideTimeout = getData().getOverrideTimeoutUnixTime();
if (overrideTimeout != null && !"NONE".equalsIgnoreCase(getData().getOverrideType())) {
return new QuantityType<Time>(overrideTimeout - (System.currentTimeMillis() / 1000L), SmartHomeUnits.SECOND).toUnit(SmartHomeUnits.MINUTE);
final QuantityType<Time> duration = new QuantityType<Time>(overrideTimeout - (System.currentTimeMillis() / 1000L), SmartHomeUnits.SECOND).toUnit(SmartHomeUnits.MINUTE);
if (duration != null)
{
return duration;
}
}
return new QuantityType<Time>(0, SmartHomeUnits.MINUTE);
}
Expand Down

0 comments on commit fe35575

Please sign in to comment.