Program: 86953
Project: 86953
Buggy source:
@Override public void onEnvironmentDetected(List<Environment> currentList){
  currentEnvironments=currentList;
  if (currentList == null || currentList.size() == 0) {
    if (SharedPreferencesHelper.isNotificationEnabled(this)) {
      startForeground(ONGOING_NOTIFICATION_ID,NotificationHelper.getAppNotification(this,"String_Node_Str"));
    }
 else {
      stopForeground(true);
    }
    Passphrase unknownPassphrase=User.getCurrentUser(this).getPassphraseForUnknownEnvironment(this);
    if (unknownPassphrase == null) {
      unknownPassphrase=Passphrase.getMasterPassword(this);
    }
    if (!unknownPassphrase.setAsCurrentPassword(this)) {
      AdminActions.initializeAdminObjects(this);
      if (!unknownPassphrase.setAsCurrentPassword(this)) {
        startService(BaseService.getServiceIntent(this,"String_Node_Str",null));
      }
    }
  }
 else {
    Environment current=currentList.get(0);
    User user=User.getCurrentUser(this);
    if (user != null) {
      Passphrase passphrase=user.getPassphraseForEnvironment(this,current);
      if (passphrase == null) {
        passphrase=user.getPassphraseForUnknownEnvironment(this);
      }
      if (passphrase != null) {
        if (!passphrase.setAsCurrentPassword(this)) {
          AdminActions.initializeAdminObjects(this);
          if (!passphrase.setAsCurrentPassword(this)) {
            startService(BaseService.getServiceIntent(this,"String_Node_Str",null));
          }
        }
      }
 else {
        Log.w(LOG_TAG,"String_Node_Str");
      }
    }
 else {
      Log.e(LOG_TAG,"String_Node_Str");
    }
    if (SharedPreferencesHelper.isNotificationEnabled(this)) {
      startForeground(ONGOING_NOTIFICATION_ID,NotificationHelper.getAppNotification(this,"String_Node_Str" + current.getName()));
    }
 else {
      stopForeground(true);
    }
  }
  if (switchUser) {
    switchUser=false;
    ScreenReceiver.turnScreenOff(this);
    ScreenReceiver.turnScreenOn(this);
  }
}

Fixed version (ground truth):
@Override public void onEnvironmentDetected(List<Environment> currentList){
  currentEnvironments=currentList;
  if (currentList == null || currentList.size() == 0) {
    if (SharedPreferencesHelper.isNotificationEnabled(this)) {
      startForeground(ONGOING_NOTIFICATION_ID,NotificationHelper.getAppNotification(this,"String_Node_Str"));
    }
 else {
      stopForeground(true);
    }
    Passphrase unknownPassphrase=User.getCurrentUser(this).getPassphraseForUnknownEnvironment(this);
    if (unknownPassphrase == null) {
      unknownPassphrase=Passphrase.getMasterPassword(this);
    }
    if (!unknownPassphrase.setAsCurrentPassword(this)) {
      AdminActions.initializeAdminObjects(this);
      if (!unknownPassphrase.setAsCurrentPassword(this)) {
        startService(BaseService.getServiceIntent(this,"String_Node_Str",null));
      }
    }
  }
 else {
    Environment current=currentList.get(0);
    User user=User.getCurrentUser(this);
    if (user != null) {
      Passphrase passphrase=user.getPassphraseForEnvironment(this,current);
      if (passphrase == null) {
        passphrase=user.getPassphraseForUnknownEnvironment(this);
      }
      if (passphrase != null) {
        if (!passphrase.setAsCurrentPassword(this)) {
          AdminActions.initializeAdminObjects(this);
          if (!passphrase.setAsCurrentPassword(this)) {
            startService(BaseService.getServiceIntent(this,"String_Node_Str",null));
          }
        }
      }
 else {
        Log.w(LOG_TAG,"String_Node_Str");
      }
    }
 else {
      Log.e(LOG_TAG,"String_Node_Str");
    }
    if (SharedPreferencesHelper.isNotificationEnabled(this)) {
      startForeground(ONGOING_NOTIFICATION_ID,NotificationHelper.getAppNotification(this,"String_Node_Str" + current.getName()));
    }
 else {
      stopForeground(true);
    }
  }
  if (switchUser) {
    switchUser=false;
    ScreenReceiver.turnScreenOff(this);
    ScreenReceiver.turnScreenOn(this);
  }
  if (mLockScreenOverlayHelper != null) {
    mLockScreenOverlayHelper.setUpEnvironmentOptions();
  }
}