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

[astro] fix invalid event creation #3807

Merged
merged 1 commit into from Jul 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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