Skip to content
Snippets Groups Projects
Commit 47dcc986 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Making sure the model handles no observations without throwing an error

parent e174d2cc
No related branches found
No related tags found
No related merge requests found
......@@ -363,6 +363,10 @@ public class DeliaRadicumFloralisObservationModel extends I18nImpl implements Mo
}
public Observation getObservationAtDate(Date currentDate) {
if(this.pestObservations == null || this.pestObservations.isEmpty())
{
return null;
}
for(Observation obs:this.pestObservations)
{
if(this.weatherUtil.normalizeToExactDate(obs.getTimeOfObservation(), timeZone).compareTo(currentDate) == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment