From 133562a06134c32c805d9ed61a64381377980ecd Mon Sep 17 00:00:00 2001 From: amentis Date: Thu, 16 May 2024 15:29:00 +0300 Subject: [PATCH] fix bugg --- .../main/java/org/opencdmp/service/dmp/DmpServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java b/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java index 7b0c48759..3bee75ac3 100644 --- a/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java +++ b/backend/core/src/main/java/org/opencdmp/service/dmp/DmpServiceImpl.java @@ -343,7 +343,7 @@ public class DmpServiceImpl implements DmpService { .groupIds(data.getGroupId()); dmpQuery.setOrder(new Ordering().addDescending(Dmp._version)); - previousDmp = dmpQuery.collect().get(0); + previousDmp = dmpQuery.count() > 0 ? dmpQuery.collect().get(0) : null; if (previousDmp != null){ if (previousDmp.getStatus().equals(DmpStatus.Finalized)) previousDmp.setVersionStatus(DmpVersionStatus.Current); else previousDmp.setVersionStatus(DmpVersionStatus.NotFinalized); @@ -1101,7 +1101,7 @@ public class DmpServiceImpl implements DmpService { .groupIds(dmp.getGroupId()); dmpQuery.setOrder(new Ordering().addDescending(Dmp._version)); - DmpEntity previousDmp = dmpQuery.collect().get(0); + DmpEntity previousDmp = dmpQuery.count() > 0 ? dmpQuery.collect().get(0) : null; if (previousDmp != null){ if (previousDmp.getStatus().equals(DmpStatus.Finalized)) previousDmp.setVersionStatus(DmpVersionStatus.Current); else previousDmp.setVersionStatus(DmpVersionStatus.NotFinalized);