Program: 170988
Project: 170988
Buggy source:
@Override public void onScanResultsReady(){
  wifiLog("String_Node_Str");
  unregisterReceiver(mContext,mWifiScanReceiver);
  final List<ScanResult> scanResultList=mWifiManager.getScanResults();
  of(mScanResultsListener).ifPresent(resultsListener -> resultsListener.onScanResults(scanResultList));
  of(mConnectionScanResultsListener).ifPresent(connectionResultsListener -> mSingleScanResult=connectionResultsListener.onConnectWithScanResult(scanResultList));
  if (mConnectionWpsListener != null && mBssid != null && mPassword != null) {
    mSingleScanResult=matchScanResultBssid(mBssid,scanResultList);
    if (mSingleScanResult != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)     connectWps(mWifiManager,mSingleScanResult,mPassword,mWpsTimeoutMillis,mConnectionWpsListener);
 else {
      if (mSingleScanResult == null)       wifiLog("String_Node_Str");
      mConnectionWpsListener.isSuccessful(false);
    }
    return;
  }
  if (mSsid != null) {
    if (mBssid != null)     mSingleScanResult=matchScanResult(mSsid,mBssid,scanResultList);
 else     mSingleScanResult=matchScanResultSsid(mSsid,scanResultList);
  }
  if (mSingleScanResult != null && mPassword != null) {
    if (isAlreadyConnected(mWifiManager,mSingleScanResult.BSSID)) {
      mWifiConnectionCallback.successfulConnect();
      return;
    }
    if (connectToWifi(mContext,mWifiManager,mSingleScanResult,mPassword))     registerReceiver(mContext,mWifiConnectionReceiver.activateTimeoutHandler(mSingleScanResult),new IntentFilter(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION));
 else     mWifiConnectionCallback.errorConnect();
  }
 else   mWifiConnectionCallback.errorConnect();
}

Fixed version (ground truth):
@Override public void onScanResultsReady(){
  wifiLog("String_Node_Str");
  unregisterReceiver(mContext,mWifiScanReceiver);
  final List<ScanResult> scanResultList=mWifiManager.getScanResults();
  of(mScanResultsListener).ifPresent(resultsListener -> resultsListener.onScanResults(scanResultList));
  of(mConnectionScanResultsListener).ifPresent(connectionResultsListener -> mSingleScanResult=connectionResultsListener.onConnectWithScanResult(scanResultList));
  if (mConnectionWpsListener != null && mBssid != null && mPassword != null) {
    mSingleScanResult=matchScanResultBssid(mBssid,scanResultList);
    if (mSingleScanResult != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)     connectWps(mWifiManager,mSingleScanResult,mPassword,mWpsTimeoutMillis,mConnectionWpsListener);
 else {
      if (mSingleScanResult == null)       wifiLog("String_Node_Str");
      mConnectionWpsListener.isSuccessful(false);
    }
    return;
  }
  if (mSsid != null) {
    if (mBssid != null)     mSingleScanResult=matchScanResult(mSsid,mBssid,scanResultList);
 else     mSingleScanResult=matchScanResultSsid(mSsid,scanResultList);
  }
  if (mSingleScanResult != null && mPassword != null) {
    if (connectToWifi(mContext,mWifiManager,mSingleScanResult,mPassword)) {
      registerReceiver(mContext,mWifiConnectionReceiver.activateTimeoutHandler(mSingleScanResult),new IntentFilter(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION));
      registerReceiver(mContext,mWifiConnectionReceiver,new IntentFilter(WifiManager.NETWORK_STATE_CHANGED_ACTION));
    }
 else     mWifiConnectionCallback.errorConnect();
  }
 else   mWifiConnectionCallback.errorConnect();
}