Commit 15731d08 authored by Marco Descher's avatar Marco Descher
Browse files

[16645] Consider taskDescriptor == null

parent d44960d7
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -259,15 +259,19 @@ public class TaskServiceImpl implements ITaskService {
			
			ITaskDescriptor taskDescriptor =
				findTaskDescriptorByIdOrReferenceId(task.getDescriptorId()).orElse(null);
			if(taskDescriptor != null) {
				OwnerTaskNotification ownerNotification = taskDescriptor.getOwnerNotification();
				IUser owner = taskDescriptor.getOwner();
				
				TaskState state = task.getState();
				if (OwnerTaskNotification.WHEN_FINISHED == ownerNotification
					|| (OwnerTaskNotification.WHEN_FINISHED_FAILED == ownerNotification
						&& TaskState.FAILED == state)) {
				sendMessageToOwner(task, taskDescriptor.getOwner(), state);
					sendMessageToOwner(task, owner, state);
				}
			} else {
				logger.error("could not load taskdescriptor by id [{}]", task.getDescriptorId());
			}			
			
		}
		
		logger.debug("notify {}", task);