‘java.util.List com.dropbox.client2.DropboxAPI$Entry.contents’ on a null object reference

I have an android application which has been working perfectly until now. Recently, I’m having an error regarding the dropbox download. I’ve been using this app and the dropbox download for months but I never had this error yet. I tried to solve it but I found nothing similar. Is something wrong with dropbox or I made some mistake?

Thanks very much in advance!

public void downAndLoad() {
AsyncTask<String, Void, Void> asyncTask = new AsyncTask<String, Void, Void>() {
        @Override@Override
        protected Void doInBackground(String... strings) {

            AndroidAuthSession session = null;
            try {
                session = buildSession();
            } catch (DropboxException e) {
                e.printStackTrace();
            }
            dropboxAPI = new DropboxAPI<>(session);
            String[] fnames = null;
            DropboxAPI.Entry dirent = null;
            try {
                dirent = dropboxAPI.metadata("/", 1000, null, true, null);
            } catch (DropboxException e) {
                e.printStackTrace();
            }
        }

            ArrayList<DropboxAPI.Entry> files = new ArrayList<DropboxAPI.Entry>();
            ArrayList<String> dir = new ArrayList<String>();


            int i = 0;
            for (DropboxAPI.Entry ent : dirent.contents) {
                files.add(ent);// Add it to the list of thumbs we can choose from
                //dir = new ArrayList<String>();
                dir.add(files.get(i++).path);
            }

            fnames = dir.toArray(new String[dir.size()]);           

Error:

10-01 00:31:08.963 11769-11961/com.example.brobert.tonda E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #4
                                                                        Process: com.example.brobert.tonda, PID: 11769
                                                                        java.lang.RuntimeException: An error occurred while executing doInBackground()
                                                                            at android.os.AsyncTask$3.done(AsyncTask.java:318)
                                                                            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
                                                                            at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
                                                                            at java.util.concurrent.FutureTask.run(FutureTask.java:242)
                                                                            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
                                                                            at java.lang.Thread.run(Thread.java:762)
                                                                         Caused by: java.lang.NullPointerException: Attempt to read from field 'java.util.List com.dropbox.client2.DropboxAPI$Entry.contents' on a null object reference
                                                                            at com.example.brobert.tonda.dldb_lp$1.doInBackground(dldb_lp.java:149)
                                                                            at com.example.brobert.tonda.dldb_lp$1.doInBackground(dldb_lp.java:126)
                                                                            at android.os.AsyncTask$2.call(AsyncTask.java:304)
                                                                            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
                                                                            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243) 
                                                                            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) 
                                                                            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) 
                                                                            at java.lang.Thread.run(Thread.java:762)