#vulnerable code 
                                private List<ExecutionStep> buildTaskExecutionSteps(
            Task task,
            Map<String, Long> taskReferences, Deque<Task> tasks,
            Flow compiledFlow) {

        List<ExecutionStep> taskExecutionSteps = new ArrayList<>();

        String taskName = task.getName();
        Long currentId = getCurrentId(taskReferences, tasks);
        boolean isAsync = task.isAsync();

        //Begin Task
        taskReferences.put(taskName, currentId);
        if (isAsync) {
            Long joinStepID = currentId + NUMBER_OF_ASYNC_LOOP_EXECUTION_STEPS + 1;
            taskExecutionSteps.add(
                    stepFactory.createAddBranchesStep(currentId++, joinStepID, currentId,
                            task.getPreTaskActionData(), compiledFlow.getId(), taskName
                    )
            );
        }
        taskExecutionSteps.add(
                stepFactory.createBeginTaskStep(currentId++, task.getArguments(),
                        task.getPreTaskActionData(), task.getRefId(), taskName)
        );

        //End Task
        Map<String, ResultNavigation> navigationValues = new HashMap<>();
        for (Map.Entry<String, String> entry : task.getNavigationStrings().entrySet()) {
            String nextStepName = entry.getValue();
            if (taskReferences.get(nextStepName) == null) {
                Task nextTaskToCompile = Lambda.selectFirst(tasks, having(on(Task.class).getName(), equalTo(nextStepName)));
                if (nextTaskToCompile == null) {
                    throw new RuntimeException("Failed to compile task: " + taskName + ". The task/result name: " + entry.getValue() + " of navigation: " + entry.getKey() + " -> " + entry.getValue() + " is missing");
                }
                taskExecutionSteps.addAll(buildTaskExecutionSteps(nextTaskToCompile, taskReferences, tasks, compiledFlow));
            }
            long nextStepId = taskReferences.get(nextStepName);
            String presetResult = (FLOW_END_STEP_ID == nextStepId) ? nextStepName : null;
            navigationValues.put(entry.getKey(), new ResultNavigation(nextStepId, presetResult));
        }
        if (isAsync) {
            taskExecutionSteps.add(
                    stepFactory.createFinishTaskStep(currentId++, task.getPostTaskActionData(),
                            new HashMap<String, ResultNavigation>(), taskName, true)
            );
            taskExecutionSteps.add(
                    stepFactory.createJoinBranchesStep(currentId, task.getPostTaskActionData(),
                            navigationValues, taskName)
            );
        } else {
            taskExecutionSteps.add(
                    stepFactory.createFinishTaskStep(currentId, task.getPostTaskActionData(),
                            navigationValues, taskName, false)
            );
        }
        return taskExecutionSteps;
    } 
                            #location 38 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                private List<ExecutionStep> buildTaskExecutionSteps(
            Task task,
            Map<String, Long> taskReferences, Deque<Task> tasks,
            Flow compiledFlow) {

        List<ExecutionStep> taskExecutionSteps = new ArrayList<>();

        String taskName = task.getName();
        Long currentId = getCurrentId(taskReferences, tasks);
        boolean isAsync = task.isAsync();

        //Begin Task
        taskReferences.put(taskName, currentId);
        if (isAsync) {
            Long joinStepID = currentId + NUMBER_OF_ASYNC_LOOP_EXECUTION_STEPS + 1;
            taskExecutionSteps.add(
                    stepFactory.createAddBranchesStep(currentId++, joinStepID, currentId,
                            task.getPreTaskActionData(), compiledFlow.getId(), taskName
                    )
            );
        }
        taskExecutionSteps.add(
                stepFactory.createBeginTaskStep(currentId++, task.getArguments(),
                        task.getPreTaskActionData(), task.getRefId(), taskName)
        );

        //End Task
        Map<String, ResultNavigation> navigationValues = new HashMap<>();
        for (Map<String, String> map : task.getNavigationStrings()) {
            Map.Entry<String, String> entry = map.entrySet().iterator().next();
            String nextStepName = entry.getValue();
            if (taskReferences.get(nextStepName) == null) {
                Task nextTaskToCompile = Lambda.selectFirst(tasks, having(on(Task.class).getName(), equalTo(nextStepName)));
                if (nextTaskToCompile == null) {
                    throw new RuntimeException("Failed to compile task: " + taskName + ". The task/result name: " + entry.getValue() + " of navigation: " + entry.getKey() + " -> " + entry.getValue() + " is missing");
                }
                taskExecutionSteps.addAll(buildTaskExecutionSteps(nextTaskToCompile, taskReferences, tasks, compiledFlow));
            }
            long nextStepId = taskReferences.get(nextStepName);
            String presetResult = (FLOW_END_STEP_ID == nextStepId) ? nextStepName : null;
            navigationValues.put(entry.getKey(), new ResultNavigation(nextStepId, presetResult));
        }
        if (isAsync) {
            taskExecutionSteps.add(
                    stepFactory.createFinishTaskStep(currentId++, task.getPostTaskActionData(),
                            new HashMap<String, ResultNavigation>(), taskName, true)
            );
            taskExecutionSteps.add(
                    stepFactory.createJoinBranchesStep(currentId, task.getPostTaskActionData(),
                            navigationValues, taskName)
            );
        } else {
            taskExecutionSteps.add(
                    stepFactory.createFinishTaskStep(currentId, task.getPostTaskActionData(),
                            navigationValues, taskName, false)
            );
        }
        return taskExecutionSteps;
    }