#fixed code
                                private Map<String, List<AppiumDevice>> filterByDevicePlatform(Map<String, List<AppiumDevice>> devicesByHost) {
        String platform = System.getenv(PLATFORM);
        if (platform.equalsIgnoreCase(OSType.BOTH.name())) {
            return devicesByHost;
        } else {
            HashMap<String, List<AppiumDevice>> filteredDevicesHostName = new HashMap<>();
            devicesByHost.forEach((hostName, appiumDevices) -> {
                List<AppiumDevice> filteredDevices = appiumDevices.stream().filter(appiumDevice ->
                        appiumDevice.getDevice().getOs().equalsIgnoreCase(platform)).collect(Collectors.toList());
                if (!filteredDevices.isEmpty())
                    filteredDevicesHostName.put(hostName, filteredDevices);
            });
            return filteredDevicesHostName;
        }
    }
#vulnerable code 
                                private Map<String, List<AppiumDevice>> filterByDevicePlatform(Map<String, List<AppiumDevice>> devicesByHost) {
        String platform = System.getProperty(PLATFORM);
        if (platform.equalsIgnoreCase(OSType.BOTH.name())) {
            return devicesByHost;
        } else {
            HashMap<String, List<AppiumDevice>> filteredDevicesHostName = new HashMap<>();
            devicesByHost.forEach((hostName, appiumDevices) -> {
                List<AppiumDevice> filteredDevices = appiumDevices.stream().filter(appiumDevice ->
                        appiumDevice.getDevice().getOs().equalsIgnoreCase(platform)).collect(Collectors.toList());
                if (!filteredDevices.isEmpty())
                    filteredDevicesHostName.put(hostName, filteredDevices);
            });
            return filteredDevicesHostName;
        }
    } 
                            #location 3 
                            #vulnerability type NULL_DEREFERENCE