[Fix] Handle null param in AbstractTransaction.getResourceByRelation() and .getResourcesByRelation()

This commit is contained in:
Robert von Burg 2020-04-27 11:52:50 +02:00
parent 0481ecc90d
commit a389cc60f1
1 changed files with 4 additions and 0 deletions

View File

@ -905,6 +905,8 @@ public abstract class AbstractTransaction implements StrolchTransaction {
DBC.PRE.assertNotNull("element", element);
DBC.PRE.assertNotEmpty("refId", refId);
StringParameter refP = element.getParameter(BAG_RELATIONS, refId, assertExists);
if (!assertExists && refP == null)
return null;
return getResourceBy(refP, assertExists);
}
@ -924,6 +926,8 @@ public abstract class AbstractTransaction implements StrolchTransaction {
DBC.PRE.assertNotNull("element", element);
DBC.PRE.assertNotEmpty("refId", refId);
StringListParameter refsP = element.getParameter(BAG_RELATIONS, refId, assertExists);
if (!assertExists && refsP == null)
return null;
return getResourcesBy(refsP, assertExists);
}