Index: ActiviteitenOpvolging/ProductiePitching/mappers/CacheMapper.vb =================================================================== diff -u -r1784 -r1785 --- ActiviteitenOpvolging/ProductiePitching/mappers/CacheMapper.vb (.../CacheMapper.vb) (revision 1784) +++ ActiviteitenOpvolging/ProductiePitching/mappers/CacheMapper.vb (.../CacheMapper.vb) (revision 1785) @@ -167,8 +167,18 @@ Dim employee As IEmployee = If(employeeInitials.Equals(String.Empty), Nothing, employees.FirstOrDefault(Function(employeeToCheck) employeeToCheck.Initials.Equals(employeeInitials))) 'Set the current state based on the enum value. If the quantity is 0, the status is automatically zero. Dim stateValue = ActivityStateEnum.Zero - If (.QuantityToProduce > 0) And (employee IsNot Nothing) Then + If (.QuantityToProduce > 0) Then stateValue = ActivityStateEnumMapper.GetActivityStateFromLetter(ExtractItemFromDataReader(Of Char)(dr, $"Status_{i}")) + If (employee Is Nothing) Then + employee = New Employee() + With employee + .FirstName = "VH" + .LastName = "Automation" + .PersonelNumber = 0 + .Number = 0 + .Initials = "" + End With + End If End If .State = ConvertEnumValueToActivityState(stateValue, activity, employee) End With