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

Avoiding Exception on non-existing Organization

parent 6d200b0c
No related branches found
No related tags found
No related merge requests found
...@@ -252,8 +252,14 @@ public class PointOfInterestBean { ...@@ -252,8 +252,14 @@ public class PointOfInterestBean {
* @return * @return
*/ */
public List<PointOfInterestWeatherStation> getWeatherstationsForOrganization(Organization organization, Boolean active) { public List<PointOfInterestWeatherStation> getWeatherstationsForOrganization(Organization organization, Boolean active) {
if(organization == null)
{
return new ArrayList<>();
}
// Avoid nulls // Avoid nulls
active = active == null ? true : active; active = active == null ? true : active;
List<PointOfInterestWeatherStation> retVal = em.createNamedQuery("PointOfInterestWeatherStation.findByActivityAndOrganizationId", PointOfInterestWeatherStation.class) List<PointOfInterestWeatherStation> retVal = em.createNamedQuery("PointOfInterestWeatherStation.findByActivityAndOrganizationId", PointOfInterestWeatherStation.class)
.setParameter("organizationId", organization) .setParameter("organizationId", organization)
.setParameter("active", active) .setParameter("active", active)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment