From 15a420247274b0c3da406c6d780da59ea96e4ea3 Mon Sep 17 00:00:00 2001 From: Raf Ponsaerts Date: Thu, 10 Oct 2019 14:08:30 +0200 Subject: [PATCH] [DS-4359] added nullcheck in EntityServiceImpl#getAllRelationshipTypes --- .../src/main/java/org/dspace/content/EntityServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java index 07b2b3062d..86b216f4d6 100644 --- a/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/EntityServiceImpl.java @@ -8,6 +8,7 @@ package org.dspace.content; import java.sql.SQLException; +import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.UUID; @@ -94,6 +95,9 @@ public class EntityServiceImpl implements EntityService { @Override public List getAllRelationshipTypes(Context context, Entity entity) throws SQLException { EntityType entityType = this.getType(context, entity); + if (entityType == null) { + return Collections.emptyList(); + } List listToReturn = new LinkedList<>(); for (RelationshipType relationshipType : relationshipTypeService.findAll(context)) { if (relationshipType.getLeftType().getID() == entityType.getID() ||