Skip to content

Commit 552c765

Browse files
author
Maximilian
committed
Removed null pointer exception when updating OS's who all didn't have a location (and we are trying to give them a location)
1 parent a189fc2 commit 552c765

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • opensilex-core/src/main/java/org/opensilex/core/event/bll

opensilex-core/src/main/java/org/opensilex/core/event/bll/MoveLogic.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ public StringUriMap<List<MoveModel>> getMovesWithLocationPerTarget(List<URI> tar
162162
public ListWithPagination<MoveModel> searchMovesWithLocationObservation(MoveSearchFilter filter) throws Exception {
163163
//Get moves
164164
ListWithPagination<MoveModel> moves = dao.search(filter);
165+
if(CollectionUtils.isEmpty(moves.getList())){
166+
return moves;
167+
}
165168
//Get locations
166169
List<LocationObservationModel> correspondingLocObs =
167170
getMovesCorrespondingLocationObservationModels(
@@ -741,6 +744,9 @@ private List<LocationObservationModel> getMovesCorrespondingLocationObservationM
741744
List<URI> modelUris,
742745
LocationObservationLogic locObsLogic
743746
){
747+
if(CollectionUtils.isEmpty(modelUris)){
748+
return Collections.emptyList();
749+
}
744750
LocationObservationSearchFilter locationObservationSearchFilter = new LocationObservationSearchFilter();
745751
locationObservationSearchFilter.setMoveUris(modelUris);
746752
locationObservationSearchFilter.setPageSize(ScientificObjectCsvImporterLogic.LOCATION_FETCHING_PAGE_SIZE);

0 commit comments

Comments
 (0)