Program: 70524
Project: 70524
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  bind=DataBindingUtil.setContentView(this,R.layout.activity_profile_setup);
switch (getIntent().getIntExtra(EXTRA_SETUP_METHOD,-1)) {
case PROFILE_SETUP_WITH_GOOGLE:
    bind.method.setImageResource(R.drawable.logo_google);
  break;
case PROFILE_SETUP_WITH_FACEBOOK:
bind.method.setImageResource(R.drawable.logo_facebook);
break;
case PROFILE_SETUP_WITH_TWITTER:
bind.method.setImageResource(R.drawable.logo_twitter);
break;
case PROFILE_SETUP_WITH_PHONE:
bind.method.setImageResource(R.drawable.logo_phone);
break;
default :
PROFILE_SETUP_WITH_EMAIL_AND_PASSWORD: bind.method.setImageResource(R.drawable.logo_login);
}
auth=FirebaseAuth.getInstance();
database=FirebaseDatabase.getInstance();
FirebaseUser user=auth.getCurrentUser();
if (user != null) {
if (user.getEmail() != null) bind.info.setText(user.getEmail());
 else if (user.getPhoneNumber() != null) bind.info.setText(user.getPhoneNumber());
if (user.getDisplayName() != null) bind.nickname.setText(user.getDisplayName());
}
 else finish();
bind.done.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
String nickname=bind.nickname.getText().toString();
FirebaseUser user=auth.getCurrentUser();
if (nickname.isEmpty()) {
showToast(R.string.empty_field);
return;
}
UserProfileChangeRequest profileChangeRequest=new UserProfileChangeRequest.Builder().setDisplayName(nickname).build();
user.updateProfile(profileChangeRequest);
database.getReference().child("String_Node_Str").child(user.getUid()).child("String_Node_Str").setValue(nickname);
String email=auth.getCurrentUser().getEmail();
if (email == null) email=auth.getCurrentUser().getPhoneNumber();
database.getReference().child("String_Node_Str").child(user.getUid()).child("String_Node_Str").setValue(email);
startActivity(new Intent(ProfileSetupActivity.this,MainActivity.class));
finish();
}
}
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  bind=DataBindingUtil.setContentView(this,R.layout.activity_profile_setup);
switch (getIntent().getIntExtra(EXTRA_SETUP_METHOD,-1)) {
case PROFILE_SETUP_WITH_GOOGLE:
    bind.methodImg.setImageResource(R.drawable.logo_google);
  bind.methodTv.setText(R.string.google);
break;
case PROFILE_SETUP_WITH_FACEBOOK:
bind.methodImg.setImageResource(R.drawable.logo_facebook);
bind.methodTv.setText(R.string.facebook);
break;
case PROFILE_SETUP_WITH_TWITTER:
bind.methodImg.setImageResource(R.drawable.logo_twitter);
bind.methodTv.setText(R.string.twitter);
break;
case PROFILE_SETUP_WITH_PHONE:
bind.methodImg.setImageResource(R.drawable.logo_phone);
bind.methodTv.setText(R.string.phone_sms);
break;
default :
PROFILE_SETUP_WITH_EMAIL_AND_PASSWORD: bind.methodImg.setImageResource(R.drawable.logo_login);
bind.methodTv.setText(R.string.email_and_password);
}
auth=FirebaseAuth.getInstance();
database=FirebaseDatabase.getInstance();
FirebaseUser user=auth.getCurrentUser();
if (user != null) {
if (user.getEmail() != null) bind.info.setText(user.getEmail());
 else if (user.getPhoneNumber() != null) bind.info.setText(user.getPhoneNumber());
if (user.getDisplayName() != null) bind.nickname.setText(user.getDisplayName());
}
 else finish();
bind.done.setOnClickListener(new View.OnClickListener(){
@Override public void onClick(View v){
String nickname=bind.nickname.getText().toString();
FirebaseUser user=auth.getCurrentUser();
if (nickname.isEmpty()) {
showToast(R.string.empty_field);
return;
}
UserProfileChangeRequest profileChangeRequest=new UserProfileChangeRequest.Builder().setDisplayName(nickname).build();
user.updateProfile(profileChangeRequest);
database.getReference().child("String_Node_Str").child(user.getUid()).child("String_Node_Str").setValue(nickname);
String email=auth.getCurrentUser().getEmail();
if (email == null) email=auth.getCurrentUser().getPhoneNumber();
database.getReference().child("String_Node_Str").child(user.getUid()).child("String_Node_Str").setValue(email);
startActivity(new Intent(ProfileSetupActivity.this,MainActivity.class));
finish();
}
}
);
}