#vulnerable code 
                                private ContainerCreationStatus getContainerCreationStatus (String serviceId, String nodePort) throws DockerException, InterruptedException {
        List<Task> tasks = dockerClient.listTasks();
        for (Task task : tasks) {
            if (task.serviceId().equals(serviceId)) {
                ContainerStatus containerStatus = task.status().containerStatus();
                String containerId = containerStatus.containerId();
                String containerName =  containerStatus.containerId();
                return new ContainerCreationStatus(true, containerName, containerId, nodePort);
            }
        }

        return null;
    } 
                            #location 6 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                private ContainerCreationStatus getContainerCreationStatus (String serviceId, String nodePort) throws DockerException, InterruptedException {
        List<Task> tasks = dockerClient.listTasks();
        for (Task task : tasks) {
            if (task.serviceId().equals(serviceId)) {
                ContainerStatus containerStatus = task.status().containerStatus();
                if (containerStatus != null) {
                    String containerId = containerStatus.containerId();
                    String containerName =  containerStatus.containerId();
                    return new ContainerCreationStatus(true, containerName, containerId, nodePort);
                }
            }
        }

        return null;
    }