check if endTime is null before comparison