#vulnerable code 
                                @Override
    public String getContainerIp(String containerName) {
        String containerId = this.getContainerId(containerName);

        if (containerId == null) {
            logger.warn("Failed to get id of container: {} ", containerName);
            return null;
        }

        try {
            List<Task> tasks = dockerClient.listTasks();
            String swarmOverlayNetwork = ZaleniumConfiguration.getSwarmOverlayNetwork();
            for (Task task : tasks) {
                ContainerStatus containerStatus = task.status().containerStatus();
                if (containerStatus != null) {
                    if (containerStatus.containerId().equals(containerId)) {
                        for (NetworkAttachment networkAttachment : CollectionUtils.emptyIfNull(task.networkAttachments())) {
                            if (networkAttachment.network().spec().name().equals(swarmOverlayNetwork)) {
                                String cidrSuffix = "/\\d+$";
                                return networkAttachment.addresses().get(0).replaceAll(cidrSuffix, "");
                            }
                        }
                    }
                }
            }
        } catch (DockerException | InterruptedException e) {
            logger.debug(nodeId + " Error while getting the container IP.", e);
            ga.trackException(e);
        }

        logger.warn("Failed to get ip of container: {}", containerName);
        return null;
    } 
                            #location 16 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Override
    public String getContainerIp(String containerName) {
        String containerId = this.getContainerId(containerName);

        if (containerId == null) {
            logger.warn("Failed to get id of container: {} ", containerName);
            return null;
        }

        try {
            String swarmOverlayNetwork = ZaleniumConfiguration.getSwarmOverlayNetwork();
            Task task = SwarmUtilities.getTaskByContainerId(containerId);
            if (task != null) {
                for (NetworkAttachment networkAttachment : CollectionUtils.emptyIfNull(task.networkAttachments())) {
                    if (networkAttachment.network().spec().name().equals(swarmOverlayNetwork)) {
                        String cidrSuffix = "/\\d+$";
                        return networkAttachment.addresses().get(0).replaceAll(cidrSuffix, "");
                    }
                }
            }
        } catch (DockerException | InterruptedException e) {
            logger.debug(nodeId + " Error while getting the container IP.", e);
            ga.trackException(e);
        }

        logger.warn("Failed to get ip of container: {}", containerName);
        return null;
    }