Error after listing 17.9

Hello! I have the following error.
java.lang.NullPointerException: Attempt to invoke virtual method ‘java.lang.String com.dl…Crime.getPhotoFilename()’ on a null object reference

 public File getPhotoFile(Crime crime) {
   File filesDir = mContext.getFilesDir();
   return new File(filesDir, crime.getPhotoFilename());
 }


public String getPhotoFilename() {
    return "CRIME_" + getId().toString() + ".jpg";
}

Why?

Based on that error message, it sounds like your Crime is null. I’d suggest using the debugger and checking to see how you end up with a null crime.