#vulnerable code 
                                public boolean send(Msg msg_, int flags_) {
        //  Drop the message if required. If we are at the end of the message
        //  switch back to non-dropping mode.
        if (dropping) {

            more = msg_.has_more();
            dropping = more;

            msg_.close ();
            return true;
        }

        Pipe pipe = null;
        while (active > start) {
            pipe = pipes.get(current);
            if (pipe.write (msg_))
                break;

            assert (!more);
            current++;
            start = current;
            if (current == active)
                current = start = active = 0;
        }

        //  If there are no pipes we cannot send the message.
        if (active == start) {
            ZError.errno(ZError.EAGAIN);
            return false;
        }

        //  If it's final part of the message we can fluch it downstream and
        //  continue round-robinning (load balance).
        more = msg_.has_more();
        if (!more) {
            pipe.flush ();
            current++;
            if (current == active)
                current = start;
        }

        return true;
    } 
                            #location 36 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                public boolean send(Msg msg_, int flags_) {
        //  Drop the message if required. If we are at the end of the message
        //  switch back to non-dropping mode.
        if (dropping) {

            more = msg_.has_more();
            dropping = more;

            msg_.close ();
            return true;
        }

        while (active > 0) {
            if (pipes.get(current).write (msg_))
                break;

            assert (!more);
            active--;
            if (current < active)
                Utils.swap (pipes, current, active);
            else
                current = 0;
        }

        //  If there are no pipes we cannot send the message.
        if (active == 0) {
            ZError.errno(ZError.EAGAIN);
            return false;
        }

        //  If it's final part of the message we can fluch it downstream and
        //  continue round-robinning (load balance).
        more = msg_.has_more();
        if (!more) {
            pipes.get(current).flush ();
            if (active > 1)
                current = (current + 1) % active;
        }

        return true;
    }