<commit_before>package com.nmakademija.nmaakademija;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;

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

public class BaseActivity extends AppCompatActivity {

    public FirebaseAuth mAuth;
    protected FirebaseAuth.AuthStateListener mAuthListener;

    protected void onUserChange(@Nullable FirebaseUser user) {
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                this.finish();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    @Override
    public void onStart() {
        super.onStart();

        if (mAuth == null)
            mAuth = FirebaseAuth.getInstance();
        if (mAuthListener == null)
            mAuthListener = new FirebaseAuth.AuthStateListener() {
                @Override
                public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                    onUserChange(firebaseAuth.getCurrentUser());
                }
            };
        mAuth.addAuthStateListener(mAuthListener);
    }<commit_msg>fix null pointer exception FirebaseAuth<commit_after>package com.nmakademija.nmaakademija;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;

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

public class BaseActivity extends AppCompatActivity {

    public FirebaseAuth mAuth;
    protected FirebaseAuth.AuthStateListener mAuthListener;

    protected void onUserChange(@Nullable FirebaseUser user) {
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                this.finish();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (mAuth == null)
            mAuth = FirebaseAuth.getInstance();
    }

    @Override
    protected void onStart() {
        super.onStart();

        if (mAuthListener == null)
            mAuthListener = new FirebaseAuth.AuthStateListener() {
                @Override
                public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                    onUserChange(firebaseAuth.getCurrentUser());
                }
            };
        mAuth.addAuthStateListener(mAuthListener);
    }
{'fraction_non_alphanumeric': 0.08189357290946786, 'fraction_numerical': 0.000691085003455425, 'mean_word_length': 2.5176184690157957, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '137753', 'n_tokens_mistral': 758, 'n_tokens_neox': 736, 'n_words': 151}