Program: 183986
Project: 183986
Buggy source:
/** 
 * @param contactUri In most cases, this should be a lookup {@link Uri}, possibly generated through   {@link Contacts#getLookupUri(long,String)}.
 */
private void returnPickerResult(Cursor c,String name,Uri contactUri){
  final Intent intent=new Intent();
  if (mShortcutAction != null) {
    Intent shortcutIntent;
    if (Intent.ACTION_VIEW.equals(mShortcutAction)) {
      shortcutIntent=new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT);
      shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
      shortcutIntent.setData(contactUri);
      shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE,ContactsContract.QuickContact.MODE_LARGE);
      shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_EXCLUDE_MIMES,(String[])null);
      final Bitmap icon=framePhoto(loadContactPhoto(contactUri,null));
      if (icon != null) {
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON,scaleToAppIconSize(icon));
      }
 else {
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(this,R.drawable.ic_launcher_shortcut_contact));
      }
    }
 else {
      String number=c.getString(PHONE_NUMBER_COLUMN_INDEX);
      int type=c.getInt(PHONE_TYPE_COLUMN_INDEX);
      String scheme;
      int resid;
      if (Intent.ACTION_CALL.equals(mShortcutAction)) {
        scheme=Constants.SCHEME_TEL;
        resid=R.drawable.badge_action_call;
      }
 else {
        scheme=Constants.SCHEME_SMSTO;
        resid=R.drawable.badge_action_sms;
      }
      Uri phoneUri=Uri.fromParts(scheme,number,null);
      shortcutIntent=new Intent(mShortcutAction,phoneUri);
      intent.putExtra(Intent.EXTRA_SHORTCUT_ICON,generatePhoneNumberIcon(contactUri,type,resid));
    }
    shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,name);
    setResult(RESULT_OK,intent);
  }
 else {
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,name);
    setResult(RESULT_OK,intent.setData(contactUri));
  }
  finish();
}

Fixed version (ground truth):
/** 
 * @param selectedUri In most cases, this should be a lookup {@link Uri}, possibly generated through   {@link Contacts#getLookupUri(long,String)}.
 */
private void returnPickerResult(Cursor c,String name,Uri selectedUri){
  final Intent intent=new Intent();
  if (mShortcutAction != null) {
    Intent shortcutIntent;
    if (Intent.ACTION_VIEW.equals(mShortcutAction)) {
      shortcutIntent=new Intent(ContactsContract.QuickContact.ACTION_QUICK_CONTACT);
      shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
      shortcutIntent.setData(selectedUri);
      shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_MODE,ContactsContract.QuickContact.MODE_LARGE);
      shortcutIntent.putExtra(ContactsContract.QuickContact.EXTRA_EXCLUDE_MIMES,(String[])null);
      final Bitmap icon=framePhoto(loadContactPhoto(selectedUri,null));
      if (icon != null) {
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON,scaleToAppIconSize(icon));
      }
 else {
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,Intent.ShortcutIconResource.fromContext(this,R.drawable.ic_launcher_shortcut_contact));
      }
    }
 else {
      String number=c.getString(PHONE_NUMBER_COLUMN_INDEX);
      int type=c.getInt(PHONE_TYPE_COLUMN_INDEX);
      String scheme;
      int resid;
      if (Intent.ACTION_CALL.equals(mShortcutAction)) {
        scheme=Constants.SCHEME_TEL;
        resid=R.drawable.badge_action_call;
      }
 else {
        scheme=Constants.SCHEME_SMSTO;
        resid=R.drawable.badge_action_sms;
      }
      Uri phoneUri=Uri.fromParts(scheme,number,null);
      shortcutIntent=new Intent(mShortcutAction,phoneUri);
      intent.putExtra(Intent.EXTRA_SHORTCUT_ICON,generatePhoneNumberIcon(selectedUri,type,resid));
    }
    shortcutIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent);
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,name);
    setResult(RESULT_OK,intent);
  }
 else {
    intent.putExtra(Intent.EXTRA_SHORTCUT_NAME,name);
    setResult(RESULT_OK,intent.setData(selectedUri));
  }
  finish();
}