title: Failing to check Firebase child (null PathString)
body: <p>I am trying to call values on my database, but I'm getting a NullPointerException when I try and query my database. </p>
  
  <p>This is my code</p>
  
  <pre><code>mUserRef = FirebaseDatabase.getInstance().getReference().child("Users").child(mCurrentUserId);
  mUserRef.keepSynced(true);
  mUserRef.addValueEventListener(new ValueEventListener() {
      @Override
      public void onDataChange(DataSnapshot dataSnapshot)
      {
          selected_group = dataSnapshot.child("group").getValue().toString();
          String position = dataSnapshot.child("position").getValue().toString();
  
          if (position.equals("head of toddlers"))
          {
              my_group = "Toddlers";
  
          }
          else if (position.equals("head of juniors"))
  
          {
              my_group = "Juniors";
  
          }
           else if (position.equals("head of seniors"))
          {
              my_group = "Seniors";
          }
          else if (position.equals("head of ambassadors"))
  
          {
              my_group = "Ambassadors";
          }
  
  
  
  
      }
  
      @Override
      public void onCancelled(DatabaseError databaseError) {
  
      }
  });
  
  
      rcvListMessage = (RecyclerView) findViewById(R.id.announcements_list);
  
      mDatabase = FirebaseDatabase.getInstance().getReference();
      mMessageReference = FirebaseDatabase.getInstance().getReference("Requests").child(my_group);  // &lt;--- this is where i'm getting the error
  </code></pre>
  
  <p>this  is my log cat</p>
  
  <pre><code>java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2695)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
     at android.app.ActivityThread.access$900(ActivityThread.java:177)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1430)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:135)
     at android.app.ActivityThread.main(ActivityThread.java:5910)
     at java.lang.reflect.Method.invoke(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:372)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200)
  Caused by: java.lang.NullPointerException: Can't pass null for argument 'pathString' in child()
     at com.google.firebase.database.DatabaseReference.child(Unknown Source)
     at org.maninresponsibility.www.womaninresponsibility.HodMembers.onCreate(HodMembers.java:113)
     at android.app.Activity.performCreate(Activity.java:6178)
     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2648)
  </code></pre>
  
  <p>The database I'm querying has Requests then a child group which groups the users on their respective groups. What am I supposed to do in order for me to be able to use child(my_group) to check for values in my database. Thank you in advance, PS. for answers I would appreciate an explanation on the cause of the error and how I should approach such cases for future references. </p>
  
  <p>this is my database structure:</p>
  
  <p><img src="https://i.stack.imgur.com/y8nok.png" alt="Database Structure"></p>