#fixed code
                                public CompiledExpression compile() {
        ASTNode tk;
        ASTNode tkOp;
        ASTNode tkOp2;
        ASTNode tkLA;
        ASTNode tkLA2;
        ASTLinkedList astLinkedList = new ASTLinkedList();

        boolean firstLA;

        ParserContext pCtx = getParserContext();

        if (verifying) {
            inputs = new LinkedHashSet<String>();
            locals = new LinkedHashSet<String>();

            getParserContext().setVariableTable(new HashMap<String, Class>());
        }

        fields |= ASTNode.COMPILE_IMMEDIATE;

        while ((tk = nextToken()) != null) {
            if (tk.fields == -1) {
                astLinkedList.addTokenNode(tk);
                continue;
            }

            returnType = tk.getEgressType();

            if (tk instanceof TypedVarNode) {
                TypedVarNode tv = (TypedVarNode) tk;
                pCtx.getVariableTable().put(tv.getName(), tv.getEgressType());
            }
            else if (pCtx.isStrictTypeEnforcement() && tk instanceof AssignmentNode
                    && (pCtx.getInputTable() == null
                    || !pCtx.getInputTable().containsKey(tk.getName()))) {

                addFatalError("untyped var not permitted in strict-mode: " + tk.getName());
            }

            if (tk instanceof Substatement) {
                ExpressionCompiler subCompiler = new ExpressionCompiler(tk.getNameAsArray());
                tk.setAccessor(subCompiler.compile());


                if (verifying)
                    inputs.addAll(subCompiler.getInputs());
            }

            /**
             * This kludge of code is to handle compile-time literal reduction.  We need to avoid
             * reducing for certain literals like, 'this', ternary and ternary else.
             */
            if (tk.isLiteral() && tk.getLiteralValue() != LITERALS.get("this")) {


                if ((tkOp = nextToken()) != null && tkOp.isOperator()
                        && !tkOp.isOperator(Operator.TERNARY) && !tkOp.isOperator(Operator.TERNARY_ELSE)) {

                    /**
                     * If the next token is ALSO a literal, then we have a candidate for a compile-time
                     * reduction.
                     */
                    if ((tkLA = nextToken()) != null && tkLA.isLiteral()) {
                        stk.push(tk.getLiteralValue(), tkLA.getLiteralValue(), tkOp.getLiteralValue());

                        /**
                         * Reduce the token now.
                         */
                        reduceTrinary();

                        firstLA = true;

                        /**
                         * Now we need to check to see if this is actually a continuing reduction.
                         */
                        while ((tkOp2 = nextToken()) != null) {
                            if (!tkOp2.isOperator(tkOp.getOperator())) {
                                /**
                                 * We can't continue any further because we are dealing with
                                 * different operators.
                                 */
                                astLinkedList.addTokenNode(new LiteralNode(stk.pop()));
                                astLinkedList.addTokenNode(tkOp2);
                                break;
                            }
                            else if ((tkLA2 = nextToken()) != null
                                    && tkLA2.isLiteral()) {

                                stk.push(tkLA2.getLiteralValue(), tkOp2.getLiteralValue());
                                reduceTrinary();
                                firstLA = false;
                            }
                            else {
                                if (firstLA) {
                                    /**
                                     * There are more tokens, but we can't reduce anymore.  So
                                     * we create a reduced token for what we've got.
                                     */
                                    astLinkedList.addTokenNode(new ASTNode(ASTNode.LITERAL, stk.pop()));
                                }
                                else {
                                    /**
                                     * We have reduced additional tokens, but we can't reduce
                                     * anymore.
                                     */
                                    astLinkedList.addTokenNode(new ASTNode(ASTNode.LITERAL, stk.pop()), tkOp);

                                    if (tkLA2 != null) astLinkedList.addTokenNode(tkLA2);
                                }
                                break;
                            }
                        }

                        /**
                         * If there are no more tokens left to parse, we check to see if
                         * we've been doing any reducing, and if so we create the token
                         * now.
                         */
                        if (!stk.isEmpty())
                            astLinkedList.addTokenNode(new ASTNode(ASTNode.LITERAL, stk.pop()));

                        continue;
                    }
                    else {
                        astLinkedList.addTokenNode(verify(tk), verify(tkOp));
                        if (tkLA != null) astLinkedList.addTokenNode(verify(tkLA));
                        continue;
                    }
                }
                else {
                    astLinkedList.addTokenNode(verify(tk));
                    if (tkOp != null) astLinkedList.addTokenNode(verify(tkOp));

                    continue;
                }
            }

            astLinkedList.addTokenNode(verify(tk));
        }

        if (verifying) {
            for (String s : locals) {
                inputs.remove(s);
            }
        }

        if (pCtx.isFatalError()) {
            parserContext.set(null);
            throw new CompileException("Failed to compile: " + pCtx.getErrorList().size() + " compilation error(s)", pCtx.getErrorList());
        }
        else if (pCtx.isFatalError()) {
            throw new CompileException("Failed to compile: " + pCtx.getErrorList().size() + " compilation error(s)", pCtx.getErrorList());
        }

        return new CompiledExpression(new ASTArrayList(astLinkedList), getCurrentSourceFileName());

    }
#vulnerable code 
                                public CompiledExpression compile() {
        ASTNode tk;
        ASTNode tkOp;
        ASTNode tkOp2;
        ASTNode tkLA;
        ASTNode tkLA2;
        ASTLinkedList astLinkedList = new ASTLinkedList();

        boolean firstLA;

        ParserContext pCtx = getParserContext();

        if (verifying) {
            inputs = new LinkedHashSet<String>();
            locals = new LinkedHashSet<String>();

            getParserContext().setVariableTable(new HashMap<String, Class>());
        }

        fields |= ASTNode.COMPILE_IMMEDIATE;

        while ((tk = nextToken()) != null) {
            if (tk.fields == -1) {
                astLinkedList.addTokenNode(tk);
                continue;
            }

            returnType = tk.getEgressType();

            if (tk instanceof TypedVarNode) {
                TypedVarNode tv = (TypedVarNode) tk;
                pCtx.getVariableTable().put(tv.getName(), tv.getEgressType());
            }
            else if (pCtx.isStrictTypeEnforcement() && tk instanceof AssignmentNode
                    && (pCtx.getInputTable() == null
                    || !pCtx.getInputTable().containsKey(tk.getName()))) {

                pCtx.addError(new ErrorDetail("untyped var not permitted in strict-mode: " + tk.getName(), true));

            }

            if (tk instanceof Substatement) {
                ExpressionCompiler subCompiler = new ExpressionCompiler(tk.getNameAsArray());
                tk.setAccessor(subCompiler.compile());


                if (verifying)
                    inputs.addAll(subCompiler.getInputs());
            }

            /**
             * This kludge of code is to handle compile-time literal reduction.  We need to avoid
             * reducing for certain literals like, 'this', ternary and ternary else.
             */
            if (tk.isLiteral() && tk.getLiteralValue() != LITERALS.get("this")) {


                if ((tkOp = nextToken()) != null && tkOp.isOperator()
                        && !tkOp.isOperator(Operator.TERNARY) && !tkOp.isOperator(Operator.TERNARY_ELSE)) {

                    /**
                     * If the next token is ALSO a literal, then we have a candidate for a compile-time
                     * reduction.
                     */
                    if ((tkLA = nextToken()) != null && tkLA.isLiteral()) {
                        stk.push(tk.getLiteralValue(), tkLA.getLiteralValue(), tkOp.getLiteralValue());

                        /**
                         * Reduce the token now.
                         */
                        reduceTrinary();

                        firstLA = true;

                        /**
                         * Now we need to check to see if this is actually a continuing reduction.
                         */
                        while ((tkOp2 = nextToken()) != null) {
                            if (!tkOp2.isOperator(tkOp.getOperator())) {
                                /**
                                 * We can't continue any further because we are dealing with
                                 * different operators.
                                 */
                                astLinkedList.addTokenNode(new LiteralNode(stk.pop()));
                                astLinkedList.addTokenNode(tkOp2);
                                break;
                            }
                            else if ((tkLA2 = nextToken()) != null
                                    && tkLA2.isLiteral()) {

                                stk.push(tkLA2.getLiteralValue(), tkOp2.getLiteralValue());
                                reduceTrinary();
                                firstLA = false;
                            }
                            else {
                                if (firstLA) {
                                    /**
                                     * There are more tokens, but we can't reduce anymore.  So
                                     * we create a reduced token for what we've got.
                                     */
                                    astLinkedList.addTokenNode(new ASTNode(ASTNode.LITERAL, stk.pop()));
                                }
                                else {
                                    /**
                                     * We have reduced additional tokens, but we can't reduce
                                     * anymore.
                                     */
                                    astLinkedList.addTokenNode(new ASTNode(ASTNode.LITERAL, stk.pop()), tkOp);

                                    if (tkLA2 != null) astLinkedList.addTokenNode(tkLA2);
                                }
                                break;
                            }
                        }

                        /**
                         * If there are no more tokens left to parse, we check to see if
                         * we've been doing any reducing, and if so we create the token
                         * now.
                         */
                        if (!stk.isEmpty())
                            astLinkedList.addTokenNode(new ASTNode(ASTNode.LITERAL, stk.pop()));

                        continue;
                    }
                    else {
                        astLinkedList.addTokenNode(verify(tk), verify(tkOp));
                        if (tkLA != null) astLinkedList.addTokenNode(verify(tkLA));
                        continue;
                    }
                }
                else {
                    astLinkedList.addTokenNode(verify(tk));
                    if (tkOp != null) astLinkedList.addTokenNode(verify(tkOp));

                    continue;
                }
            }

            astLinkedList.addTokenNode(verify(tk));
        }

        if (verifying) {
            for (String s : locals) {
                inputs.remove(s);
            }
        }

        if (compileFail) {
            throw new CompileException("Failed to compile: " + getParserContext().getErrorList().size() + " compilation error(s)", getParserContext().getErrorList());
        }

        if (pCtx.getRootParser() == this) {
            parserContext.set(null);
        }

        return new CompiledExpression(new ASTArrayList(astLinkedList), getCurrentSourceFileName());
    } 
                            #location 150 
                            #vulnerability type NULL_DEREFERENCE