android - I am getting NPE for UUID, and I don't know why -


this question has answer here:

   public crash getcrash() {     string uuidstring = getstring(getcolumnindex(crashtable.cols.uuid));     string name = getstring(getcolumnindex(crashtable.cols.driver1));     string insco = getstring(getcolumnindex(crashtable.cols.insco));     string policy = getstring(getcolumnindex(crashtable.cols.policy));     string telephone = getstring(getcolumnindex(crashtable.cols.phone));     string email = getstring(getcolumnindex(crashtable.cols.email));      **crash crash = new crash(uuid.fromstring(uuidstring));**     crash.setyourname(name);     crash.setinsco(insco);     crash.setpolicy(policy);     crash.settelephone(telephone);     crash.setemail(email);      return crash; } 

the line marked causing npe (uuid == null). seems have problem fromstring. here's pertinent portion of "crash" class it's referencing.

public class crash  {  private uuid mid; private string myourname; private string minsco; private string mpolicy; private string mtelephone; private string memail; private date mdate;  public crash() {     this(uuid.randomuuid()); }  public crash(uuid id) {     mid = id;     mdate = new date(); }  public uuid getid() {     return mid; } 

is there i'm missing? i'm pretty new this, if there's more information you're needing, please let me know. in advance.

check whether uuid string passing in not null.

if not null, check format of uuid string using.

example uuid conversion :

// creating uuid       uuid uid = uuid.fromstring("38400000-8cf0-11bd-b23e-10b96e4ef00d");