Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
[astro] fix invalid event creation (#3807)
Browse files Browse the repository at this point in the history
Signed-off-by: Henning Treu <henning.treu@telekom.de>
  • Loading branch information
htreu authored and sjsf committed Jul 5, 2017
1 parent 07f5758 commit e2a13e9
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -118,9 +118,15 @@ public static void scheduleRange(String thingUID, AstroThingHandler astroHandler
if (thingNull || astroHandlerNull || rangeNull || channelIdNull) {
return;
}

Calendar start = range.getStart();
Calendar end = range.getEnd();

// depending on the location you might not have a valid range for day/night, so skip the events:
if (start == null || end == null) {
return;
}

if (truncatedEquals(start, end, SECOND)) {
scheduleEvent(thingUID, astroHandler, start, asList(EVENT_START, EVENT_END), channelId);
} else {
Expand Down

0 comments on commit e2a13e9

Please sign in to comment.