I am trying to access permission for the user to edit his/her own details in a firebase database, but I am finding a null pointer exception while invoking `root_dir_ref.getAuth().getUid()`.

The database structure is
/Users/{uid}/name,phone,age

And rules for database is:

```
{
  "rules": {
  "Users":{
        "$uid":{
            ".read":true,
            ".write":"$uid == auth.uid"
        }
    }
  }
}

```

This is my code:

package com.example.limat.finder;

```
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;
    import android.widget.ImageView;
    import android.widget.Toast;

    import com.firebase.client.Firebase;
    import com.google.firebase.auth.FirebaseAuth;
    import com.google.firebase.auth.FirebaseUser;

    public class SetupActivity extends AppCompatActivity {

        EditText username,age,phoneno;
        Button profile_pic_selector,submit_button;
        ImageView profile_pic;

        private Firebase root_dir_ref;
        private FirebaseAuth authoriser;
        private Firebase user_ref;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_setup);

            Firebase.setAndroidContext(this);

            username = (EditText)findViewById(R.id.username);
            age = (EditText)findViewById(R.id.age);
            phoneno = (EditText)findViewById(R.id.phone_no);

            profile_pic_selector = (Button)findViewById(R.id.change_button);
            submit_button = (Button)findViewById(R.id.setup_submit_button);

            profile_pic = (ImageView)findViewById(R.id.profile_pic);

            authoriser = FirebaseAuth.getInstance();
            final FirebaseUser user = authoriser.getCurrentUser();
            root_dir_ref = new Firebase("https://finder-acbff.firebaseio.com/");
            user_ref = root_dir_ref.child("Users/"+root_dir_ref.getAuth().getUid());

            submit_button.setOnClickListener(
                    new Button.OnClickListener()
                    {
                        public void onClick(View v)
                        {
                            if(!username.getText().toString().equals("")&&!age.getText().toString().equals("")&&!phoneno.getText().toString().equals(""))
                            {

                                user_ref.child("Name").setValue(username.getText().toString());
                                user_ref.child("Age").setValue(age.getText().toString());
                                user_ref.child("Phone").setValue(phoneno.getText().toString());

                            }
                        }
                    }
            );

        }
    }

```

The fact is I tried all the method available in stackoverflow to user editing but all were denying permission to write data into database.

I tried with public permission for write and read and it WORKS perfectly 

Only when I have some rules it doesn't work

I tried the above code and ended up in null pointer exception