#vulnerable code 
                                @Override
    protected boolean xsend(Msg msg_)
    {
        //  If this is the first part of the message it's the ID of the
        //  peer to send the message to.
        if (!more_out) {
            assert (current_out == null);

            //  If we have malformed message (prefix with no subsequent message)
            //  then just silently ignore it.
            //  TODO: The connections should be killed instead.
            if (msg_.has_more()) {

                more_out = true;

                //  Find the pipe associated with the identity stored in the prefix.
                //  If there's no such pipe just silently ignore the message, unless
                //  mandatory is set.
                Blob identity = new Blob(msg_.data());
                Outpipe op = outpipes.get(identity);

                if (op != null) {
                    current_out = op.pipe;
                    if (!current_out.check_write ()) {
                        op.active = false;
                        current_out = null;
                        if (mandatory) {
                            more_out = false;
                            errno.set(ZError.EAGAIN);
                            return false;
                        }
                    }
                } else if (mandatory) {
                    more_out = false;
                    errno.set(ZError.EHOSTUNREACH);
                    return false;
                }
            }

            return true;
        }

        //  Check whether this is the last part of the message.
        more_out = msg_.has_more();

        //  Push the message into the pipe. If there's no out pipe, just drop it.
        if (current_out != null) {
            boolean ok = current_out.write (msg_);
            if (!ok)
                current_out = null;
            else if (!more_out) {
                current_out.flush ();
                current_out = null;
            }
        }

        return true;
    } 
                            #location 19 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                @Override
    protected boolean xsend(Msg msg_)
    {
        //  If this is the first part of the message it's the ID of the
        //  peer to send the message to.
        if (!more_out) {
            assert (current_out == null);

            //  If we have malformed message (prefix with no subsequent message)
            //  then just silently ignore it.
            //  TODO: The connections should be killed instead.
            if (msg_.has_more()) {

                more_out = true;

                //  Find the pipe associated with the identity stored in the prefix.
                //  If there's no such pipe just silently ignore the message, unless
                //  mandatory is set.
                Blob identity = Blob.createBlob(msg_.data(), true);
                Outpipe op = outpipes.get(identity);

                if (op != null) {
                    current_out = op.pipe;
                    if (!current_out.check_write ()) {
                        op.active = false;
                        current_out = null;
                        if (mandatory) {
                            more_out = false;
                            errno.set(ZError.EAGAIN);
                            return false;
                        }
                    }
                } else if (mandatory) {
                    more_out = false;
                    errno.set(ZError.EHOSTUNREACH);
                    return false;
                }
            }

            return true;
        }

        //  Check whether this is the last part of the message.
        more_out = msg_.has_more();

        //  Push the message into the pipe. If there's no out pipe, just drop it.
        if (current_out != null) {
            boolean ok = current_out.write (msg_);
            if (!ok)
                current_out = null;
            else if (!more_out) {
                current_out.flush ();
                current_out = null;
            }
        }

        return true;
    }