diff --git a/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java b/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java index e73c1b1..1379150 100644 --- a/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/queue/api/impl/QueueEntryServiceImpl.java @@ -257,11 +257,14 @@ private void endQueueEntry(@NotNull QueueEntry queueEntry) { @Transactional(readOnly = true) public QueueEntry getPreviousQueueEntry(@NotNull QueueEntry queueEntry) { Queue queueComingFrom = queueEntry.getQueueComingFrom(); + if(queueComingFrom == null) { + return null; + } QueueEntrySearchCriteria criteria = new QueueEntrySearchCriteria(); criteria.setPatient(queueEntry.getPatient()); criteria.setVisit(queueEntry.getVisit()); criteria.setEndedOn(queueEntry.getStartedAt()); - criteria.setQueues(queueComingFrom == null ? Arrays.asList() : Arrays.asList(queueComingFrom)); + criteria.setQueues(Arrays.asList(queueComingFrom)); List prevQueueEntries = dao.getQueueEntries(criteria); if (prevQueueEntries.size() == 1) { return prevQueueEntries.get(0);