Program: 81075
Project: 81075
Buggy source:
@Override public void onListItemClick(ListView l,View v,int position,long id){
  final ArrivalInfo stop=(ArrivalInfo)getListView().getItemAtPosition(position);
  if (stop == null) {
    return;
  }
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.stop_info_item_options_title);
  ObaArrivalInfoResponse response=getArrivalsLoader().getLastGoodResponse();
  final ObaRoute route=response.getRoute(stop.getInfo().getRouteId());
  final String url=route != null ? route.getUrl() : null;
  final boolean hasUrl=!TextUtils.isEmpty(url);
  int options;
  View tripView=v.findViewById(R.id.trip_info);
  if (tripView.getVisibility() != View.GONE) {
    if (hasUrl) {
      options=R.array.stop_item_options_edit;
    }
 else {
      options=R.array.stop_item_options_edit_noschedule;
    }
  }
 else   if (hasUrl) {
    options=R.array.stop_item_options;
  }
 else {
    options=R.array.stop_item_options_noschedule;
  }
  builder.setItems(options,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      if (which == 0) {
        goToTrip(stop);
      }
 else       if (which == 1) {
        goToRoute(stop);
      }
 else       if (which == 2) {
        ArrayList<String> routes=new ArrayList<String>(1);
        routes.add(stop.getInfo().getRouteId());
        setRoutesFilter(routes);
        mHeader.refresh();
      }
 else       if (hasUrl && which == 3) {
        UIHelp.goToUrl(getActivity(),url);
      }
 else       if ((!hasUrl && which == 3) || (hasUrl && which == 4)) {
        ReportTripProblemFragment.show(getSherlockActivity(),stop.getInfo());
      }
    }
  }
);
  AlertDialog dialog=builder.create();
  dialog.setOwnerActivity(getActivity());
  dialog.show();
}

Fixed version (ground truth):
@Override public void onListItemClick(ListView l,View v,int position,long id){
  final ArrivalInfo stop=(ArrivalInfo)getListView().getItemAtPosition(position);
  if (stop == null) {
    return;
  }
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  builder.setTitle(R.string.stop_info_item_options_title);
  ObaArrivalInfoResponse response=getArrivalsLoader().getLastGoodResponse();
  final ObaRoute route=response.getRoute(stop.getInfo().getRouteId());
  final String url=route != null ? route.getUrl() : null;
  final boolean hasUrl=!TextUtils.isEmpty(url);
  int options;
  View tripView=v.findViewById(R.id.trip_info);
  if (tripView.getVisibility() != View.GONE) {
    if (hasUrl) {
      options=R.array.stop_item_options_edit;
    }
 else {
      options=R.array.stop_item_options_edit_noschedule;
    }
  }
 else   if (hasUrl) {
    options=R.array.stop_item_options;
  }
 else {
    options=R.array.stop_item_options_noschedule;
  }
  builder.setItems(options,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int which){
      if (which == 0) {
        goToTrip(stop);
      }
 else       if (which == 1) {
        goToRoute(stop);
      }
 else       if (which == 2) {
        ArrayList<String> routes=new ArrayList<String>(1);
        routes.add(stop.getInfo().getRouteId());
        setRoutesFilter(routes);
        if (mHeader != null) {
          mHeader.refresh();
        }
      }
 else       if (hasUrl && which == 3) {
        UIHelp.goToUrl(getActivity(),url);
      }
 else       if ((!hasUrl && which == 3) || (hasUrl && which == 4)) {
        ReportTripProblemFragment.show(getSherlockActivity(),stop.getInfo());
      }
    }
  }
);
  AlertDialog dialog=builder.create();
  dialog.setOwnerActivity(getActivity());
  dialog.show();
}