Error123: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference : <p>please do not mark this question as duplicate, because I have all of the solutions on similar questions to this, and they haven't worked. Not saying that those answers were wrong, just that it isn't working for me at least. Thanks.</p>

<p>Here is my if statement:</p>

<pre><code>                if (dataSnapshot.exists() &amp;&amp; !dataSnapshot.child("connections").child("nope").hasChild(currentUId) &amp;&amp; !dataSnapshot.child("connections").child("yes").hasChild(currentUId)){
                String profileImageUrl = "default";
                if (profileImageUrl !=null &amp;&amp; !dataSnapshot.child("profileImageUrl").getValue().equals("default")){
                    profileImageUrl = dataSnapshot.child("profileImageUrl").getValue().toString();
                }
                com.example.tiarnan.tinder.cards item = new com.example.tiarnan.tinder.cards(dataSnapshot.getKey(), dataSnapshot.child("name").getValue().toString(), profileImageUrl);
                rowItems.add(item);
                arrayAdapter.notifyDataSetChanged();
            }
</code></pre>

<p>As you can see, I did try to put a != null, but it still isn't working. That was the most seen solution on the duplicate questions.</p>

<p>Thanks in advance, and I hope you guys can help me solve this.</p>
