#vulnerable code 
                                public List<ProjectMailTicketConfig> findAll() {
        List<ProjectMailTicketConfig> configs = queries.findAllConfigs();
        List<ProjectMailTicket> ticketConfigs = queries.findAllTickets();

        Map<Integer, List<ProjectMailTicket>> ticketConfigsByConfigId = new HashMap<>();
        for(ProjectMailTicket ticketConfig: ticketConfigs) {
            if(!ticketConfigsByConfigId.containsKey(ticketConfig.getConfigId())) {
                ticketConfigsByConfigId.put(ticketConfig.getConfigId(), new ArrayList<ProjectMailTicket>());
            }

            ticketConfigsByConfigId.get(ticketConfig.getConfigId()).add(ticketConfig);
        }

        for(ProjectMailTicketConfig config: configs) {
            if(ticketConfigsByConfigId.containsKey(config.getId())) {
                config.getEntries().addAll(ticketConfigsByConfigId.get(config.getId()));
            }
        }

        return configs;
    } 
                            #location 11 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public List<ProjectMailTicketConfig> findAll() {
        return aggregateByConfig(queries.findAllConfigs(), queries.findAllTickets());
    }