title: Null object refrences in android studio?
body: <p>I want to created a chat app project with android studio and when I want to run my project my app crashed please help me?</p>
  
  <p><strong>My code is below:</strong></p>
  
  <pre><code>private void readUser()
  {
      final FirebaseUser firebaseUser = FirebaseAuth.getInstance().getCurrentUser();
      DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Users");
  
      reference.addValueEventListener(new ValueEventListener()
      {
          @Override
          public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
              if (search.getText().toString().equals("")) {
                  mUsers.clear();
  
                  for (DataSnapshot snapshot : dataSnapshot.getChildren()) {
                      User user = snapshot.getValue(User.class);
  
                      assert user != null;
                      assert firebaseUser != null;
  
                      if (!user.getId().equalsIgnoreCase(firebaseUser.getUid())) {
                          mUsers.add(user);
                      }
                  }
                  userAdapter = new UserAdapter(getContext(), mUsers, false);
                  recyclerView.setAdapter(userAdapter);
              }
          }
          @Override
          public void onCancelled(@NonNull DatabaseError databaseError)
          {
          }
      });
  }
  </code></pre>
  
  <p>and this is my <strong>error:</strong></p>
  
  <pre><code>java.lang.NullPointerException
      at com.example.mahdi.chatapp.Fragments.UsersFragment$3.onDataChange(UsersFragment.java:132)
  </code></pre>
  
  <p>and error from this <strong>line:</strong></p>
  
  <pre><code>if (!user.getId().equalsIgnoreCase(firebaseUser.getUid())) {
  </code></pre>