Buggy code:
public class PromoCardAnimator extends Activity implements GestureDetector . OnGestureListener , AlertDialogsResponses , SubscribedActivities { private GestureDetectorCompat gestureDetector ; private ViewFlipper promosFlipper ; Animation slide_in_left ; Animation slide_out_right ; Animation slide_in_right ; Animation slide_out_left ; private HttpHandler httpHandler = new HttpHandler ( ) ; public static final String ACTION_PROMOS_DETAILS = "//promos//details" ; public static final String ACTION_NOW = "//promo//now" ; private Map < String , String > params = new HashMap < String , String > ( ) ; private TextView promoTitle ; private TextView promoStoreName ; private TextView promoAvailableRedemptions ; private TextView promoDescription ; private TextView promoTerms ; private Button nowButton ; private TextView redemptionCode ; private AlertDialogCreator alertDialogCreator = new AlertDialogCreator ( ) ; public static String action ; private int branchId ; private String code ; private String storeName ; private boolean isUserPromoRedeemed ; private ArrayList < Promo > promos = new ArrayList < > ( ) ; private Map < Integer , Redemption > userPromos = new TreeMap < > ( ) ; private Map < Integer , Promo > promosMap = new TreeMap < > ( ) ; public static final String TAKE_PROMO = "TAKE_PROMO" ; public static final String OBTAINED_PROMO = "OBTAINED_PROMO" ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } public void initView ( ) { } public void setFlipperAnimation ( ) { } public void capturePromos ( ) { } public void setBranchPromos ( ) { } public void setPromosIdsList ( ) { } public void sendRequest ( String request ) { } public void addPromosToFlipper ( ) { for ( int i = 0 ; i < ( promos . size ( ) ) ; ++ i ) { Promo promo = promos . get ( i ) ; LayoutInflater inflater = ( ( LayoutInflater ) ( this . getSystemService ( LAYOUT_INFLATER_SERVICE ) ) ) ; View promoCard = inflater . inflate ( promo_card , null ) ; promoCard . setId ( promo . getId ( ) ) ; promosFlipper . addView ( promoCard ) ; promoTitle = ( ( TextView ) ( promoCard . findViewById ( promo_title ) ) ) ; promoStoreName = ( ( TextView ) ( promoCard . findViewById ( promo_store_name ) ) ) ; final TextView promoExpirationDate = ( ( TextView ) ( promoCard . findViewById ( promo_expiration_date ) ) ) ; promoAvailableRedemptions = ( ( TextView ) ( promoCard . findViewById ( promo_available_redemptions ) ) ) ; promoDescription = ( ( TextView ) ( promoCard . findViewById ( promo_description ) ) ) ; promoTerms = ( ( TextView ) ( promoCard . findViewById ( promo_terms ) ) ) ; nowButton = ( ( Button ) ( promoCard . findViewById ( now_button ) ) ) ; redemptionCode = ( ( TextView ) ( promoCard . findViewById ( redemption_code ) ) ) ; promoTitle . setText ( promo . getTitle ( ) ) ; promoStoreName . setText ( storeName ) ; promoExpirationDate . setText ( promo . getExpirationDate ( ) ) ; promoAvailableRedemptions . setText ( String . valueOf ( promo . getAvailableRedemptions ( ) ) ) ; promoDescription . setText ( promo . getDescription ( ) ) ; promoTerms . setText ( promo . getTerms ( ) ) ; if ( PromoCardAnimator . action . equals ( SHOW_BRANCH_PROMOS ) ) { <START_BUG> if ( userPromos . containsKey ( promo . getId ( ) ) ) { <END_BUG> code = takenPromos . get ( promo . getId ( ) ) . getCode ( ) ; isUserPromoRedeemed = takenPromos . get ( promo . getId ( ) ) . isRedeemed ( ) ; changeButtonToCode ( ) ; } } else if ( PromoCardAnimator . action . equals ( SHOW_PROMO_TO_REDEEM ) ) { changeButtonToCode ( ) ; } CountDownTimer countDownTimer = createCountDownTimer ( promoExpirationDate , promo . getExpirationDate ( ) ) ; countDownTimer . start ( ) ; } } public CountDownTimer createCountDownTimer ( final TextView countDownView , String expirationDate ) { } public void changeButtonToCode ( ) { } public void now ( View v ) { } public void askToTakePromo ( ) { } public void showObtainedPromo ( ) { } @ Override public void notifyToRespond ( String action ) { } @ Override public void notify ( String action , JSONObject responseJson ) { } @ Override public boolean dispatchTouchEvent ( MotionEvent event ) { } @ Override public boolean onTouchEvent ( MotionEvent event ) { } @ Override public boolean onDown ( MotionEvent e ) { } @ Override public void onShowPress ( MotionEvent e ) { } @ Override public boolean onSingleTapUp ( MotionEvent e ) { } @ Override public boolean onScroll ( MotionEvent e1 , MotionEvent e2 , float distanceX , float distanceY ) { } @ Override public void onLongPress ( MotionEvent e ) { } @ Override public boolean onFling ( MotionEvent e1 , MotionEvent e2 , float velocityX , float velocityY ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } }

Fix:
if ( ( ( userPromos ) != null ) && ( userPromos . containsKey ( promo . getId ( ) ) ) ) {