#fixed code
                                private String getContainerId(String zaleniumContainerName, URL remoteUrl) {
        try {
            List<Task> tasks = dockerClient.listTasks();
            for (Task task : tasks) {
                List<NetworkAttachment> networkAttachments = task.networkAttachments();
                if (networkAttachments != null) {
                    for (NetworkAttachment networkAttachment : task.networkAttachments()) {
                        for (String address : networkAttachment.addresses()) {
                            if (address.startsWith(remoteUrl.getHost())) {
                                return task.status().containerStatus().containerId();
                            }
                        }
                    }
                }
            }
        } catch (DockerException | InterruptedException e) {
            e.printStackTrace();
        }

        return null;
    }
#vulnerable code 
                                private String getContainerId(String zaleniumContainerName, URL remoteUrl) {
        try {
            List<Task> tasks = dockerClient.listTasks();
            logger.debug("---------------Size of tasks list : {} ---------------", tasks.size());
            for (Task task : tasks) {
                logger.debug("--------------- Task : {} ---------------", task);
                for (NetworkAttachment networkAttachment : task.networkAttachments()) {
                    for (String address : networkAttachment.addresses()) {
                        if (address.startsWith(remoteUrl.getHost())) {
                            return task.status().containerStatus().containerId();
                        }
                    }
                }
            }
        } catch (DockerException | InterruptedException e) {
            e.printStackTrace();
        }

        return null;
    } 
                            #location 7 
                            #vulnerability type NULL_DEREFERENCE