Q:

What is causing this error (java): "Invalid memory access of location 0x0 rip=0x106282bae"

I am working on a P2P Twitter client for an introductory networking class. I am attempting to give my peer a way to register itself so other peers can discover it. I am creating a DNS TXT record so that I can call DNSSD.Register(). However, when this method is called I get an error that reads:
What is causing this error (java): "Invalid memory access of location 0x0 rip=0x106282bae" 
Here is the method that is causing it:
import com.apple.dnssd.*;
    public static void announce()throws com.apple.dnssd.DNSSDException{
        TXTRecord txtRec = new TXTRecord();
        txtRec.set("Version", "1.1");
        txtRec.set("EncryptionSupport", "false");
        txtRec.set("DisplayName", profile.getPropertyValue("UserName"));
        txtRec.set("UserID", profile.getPropertyValue("UserID"));

        RegisterListener myRegisterListener = null;
        DNSSDRegistration reg = null;
        RegisterListener myRegistrationListener = null;
        reg = DNSSD.register
            (0, DNSSD.ALL_INTERFACES, profile.getPropertyValue("UserName"),
            profile.getPropertyValue("DNSSDServiceName"), 
            null, null, 4444, txtRec, myRegistrationListener);
    }

The "reg = ..." line is the one that causes the error to happen. Any ideas about what I'm doing wrong? A lot of this was taken from examples I don't fully understand.

A:

The problem is that the last argument of DNSSD.register() method should be a valid object.
Since you are passing it as a NULL pointer, when it is called you get a invalid access to the 0x0 location.
Take a look at the docs for this method.

