The following error appears:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
at novapetbeta.platypus.com.novapetbeta.Principal$6.onChildAdded(Principal.java:185)
at com.google.android.gms.internal.zzdri.zza(Unknown Source:33)
at com.google.android.gms.internal.zzdwu.zzbvb(Unknown Source:2)
at com.google.android.gms.internal.zzdxa.run(Unknown Source:65)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
This is the code that is displaying the error.
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
if(dataSnapshot.exists() && !dataSnapshot.child("connections").child("Meh").hasChild(atualUID) && !dataSnapshot.child("connections").child("Gostei").hasChild(atualUID)){
String ImagemPerfilURL = "default";
if (!dataSnapshot.child("ImagemPerfilURL").getValue().equals("default")){
ImagemPerfilURL = dataSnapshot.child("ImagemPerfilURL").getValue().toString();
}
I'm new to mobile development and I can not seem to figure it out. Thanks for the help.