When I tried to test to find a document that is not in my firestore, I don't know why it sends a nullPointerError. What is the cause of this error? This is my code to get the list of documents that I want. In this case, I use userID as some arbitrary string that is not in my firestore.
If I tried to test it with a document that is available in my firestore it works. I was expecting for an empty list when I use an arbitrary userID. In the test console it said that the NullPointerException is coming from line "return db.runTransaction(tx -> {". This question is different from null pointer description as I already tried if(budgetRef==null) return budgets but it didn't work. Thank you
return db.runTransaction(tx -> {
            List<Budget> budgets = new ArrayList<>();
            ApiFuture<QuerySnapshot> budgetRef = tx.get(db.collection("users").document(userID).collection("budgets").orderBy("start_date", Query.Direction.DESCENDING));
            for (QueryDocumentSnapshot budgetDocument : budgetRef.get().getDocuments()) {
                Budget budget = createBudgetByDocument(budgetDocument, tx);
                if(budget.getStart_date().compareTo(currentDate) <= 0 && budget.getEnd_date().compareTo(currentDate) >= 0){
                    budgets.add(budget);
                }
            }
            return budgets;
        }).get();
