I was playing with Firebase, removing and adding users.
Then I decided to delete all my users and now I still can access nodes that doesn't exist anymore.
Below is how I'm retrieving the dataSnapshot and a print from my most recent Firebase database.
mFirebaseUsersRef = new Firebase(Constants.FIREBASE_URL_USERS).child(mLoggedUser.getEmail());
mFirebaseUsersRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(dataSnapshot.exists()) {
mLoggedUser = dataSnapshot.child(mLoggedUser.getEmail()).getValue(User.class);
Firebase database image
Notice that there's only one user on the users list, however if my mFirebaseUsersRef referencies an email that had a node before deleting all my users at my Firebase database, but now doesn't exist, the dataSnapshot will retrieve all the data that existed before deleting the node.
I hope I made myself clear, I will be pleased to answer any doubt about my question.
Below is a print of the nonexistent data that my dataSnapshot is retrieving
Ghost data
EDIT
After debugging each line, I noticed something odd, the dataSnapshot at first exist as shown here: Ghost data, but after going through the entire if (even through startActivity(i);
) it returns to if(dataSnapshot.exists()) {
and shows that the dataSnapshot is now null: Now node is null