Program: 94114
Project: 94114
Buggy source:
public static void addSaveButtonsAndGestures(XC_InitPackageResources.InitPackageResourcesParam resparam,XModuleResources mResources,final Context localContext){
  final GestureEvent gestureEvent=new GestureEvent();
  Logger.log("String_Node_Str",false,true);
  final Bitmap saveImg=BitmapFactory.decodeResource(mResources,R.mipmap.save_button);
  if (saveImg == null)   throw new NullPointerException("String_Node_Str");
  int horizontalPosition=Preferences.mButtonPosition ? Gravity.START : Gravity.END;
  final FrameLayout.LayoutParams layoutParams=new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.BOTTOM | horizontalPosition);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final FrameLayout frameLayout=(FrameLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getParent();
      ViewGroup overlay_group=(ViewGroup)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP));
      saveStoryButton=new ImageButton(localContext);
      saveStoryButton.setLayoutParams(layoutParams);
      saveStoryButton.setBackgroundColor(0);
      saveStoryButton.setImageBitmap(saveImg);
      saveStoryButton.setAlpha(0.8f);
      saveStoryButton.setVisibility(Preferences.mModeStory == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.mModeStory == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.STORY);
        }
      }
);
      frameLayout.addView(saveStoryButton);
      overlay_group.bringToFront();
      saveStoryButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Saving.performButtonSave();
        }
      }
);
    }
  }
);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final FrameLayout frameLayout=(FrameLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getParent();
      saveSnapButton=new ImageButton(localContext);
      saveSnapButton.setLayoutParams(layoutParams);
      saveSnapButton.setBackgroundColor(0);
      saveSnapButton.setAlpha(1f);
      saveSnapButton.setImageBitmap(saveImg);
      saveSnapButton.setVisibility(Preferences.mModeSave == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.mModeSave == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.SNAP);
        }
      }
);
      frameLayout.addView(saveSnapButton);
      saveSnapButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Logger.printTitle("String_Node_Str");
          Saving.performButtonSave();
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
public static void addSaveButtonsAndGestures(XC_InitPackageResources.InitPackageResourcesParam resparam,XModuleResources mResources,final Context localContext){
  final GestureEvent gestureEvent=new GestureEvent();
  Logger.log("String_Node_Str",false,true);
  final Bitmap saveImg=BitmapFactory.decodeResource(mResources,R.drawable.save_button);
  if (saveImg == null)   throw new NullPointerException("String_Node_Str");
  int horizontalPosition=Preferences.mButtonPosition ? Gravity.START : Gravity.END;
  final FrameLayout.LayoutParams layoutParams=new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,FrameLayout.LayoutParams.WRAP_CONTENT,Gravity.BOTTOM | horizontalPosition);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final FrameLayout frameLayout=(FrameLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getParent();
      ViewGroup overlay_group=(ViewGroup)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP));
      saveStoryButton=new ImageButton(localContext);
      saveStoryButton.setLayoutParams(layoutParams);
      saveStoryButton.setBackgroundColor(0);
      saveStoryButton.setImageBitmap(saveImg);
      saveStoryButton.setAlpha(0.8f);
      saveStoryButton.setVisibility(Preferences.mModeStory == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.mModeStory == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.STORY);
        }
      }
);
      frameLayout.addView(saveStoryButton);
      overlay_group.bringToFront();
      saveStoryButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Saving.performButtonSave();
        }
      }
);
    }
  }
);
  resparam.res.hookLayout(Common.PACKAGE_SNAP,"String_Node_Str","String_Node_Str",new XC_LayoutInflated(){
    @Override public void handleLayoutInflated(    LayoutInflatedParam liparam) throws Throwable {
      Logger.log("String_Node_Str");
      final FrameLayout frameLayout=(FrameLayout)liparam.view.findViewById(liparam.res.getIdentifier("String_Node_Str","String_Node_Str",Common.PACKAGE_SNAP)).getParent();
      saveSnapButton=new ImageButton(localContext);
      saveSnapButton.setLayoutParams(layoutParams);
      saveSnapButton.setBackgroundColor(0);
      saveSnapButton.setAlpha(1f);
      saveSnapButton.setImageBitmap(saveImg);
      saveSnapButton.setVisibility(Preferences.mModeSave == Preferences.SAVE_BUTTON ? View.VISIBLE : View.INVISIBLE);
      frameLayout.setOnTouchListener(new View.OnTouchListener(){
        @Override public boolean onTouch(        View v,        MotionEvent event){
          return Preferences.mModeSave == Preferences.SAVE_S2S && gestureEvent.onTouch(v,event,Saving.SnapType.SNAP);
        }
      }
);
      frameLayout.addView(saveSnapButton);
      saveSnapButton.setOnClickListener(new View.OnClickListener(){
        @Override public void onClick(        View v){
          Logger.printTitle("String_Node_Str");
          Saving.performButtonSave();
        }
      }
);
    }
  }
);
}