[Demonstration 1]

[Buggy Method]
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // If activity recreated (such as from screen rotate), restore
    // the previous selection set by onSaveInstanceState().
    // This is primarily necessary when in the two-pane layout.
    if (savedInstanceState != null) {
        mCurrentPosition = savedInstanceState.getInt(ARG_POSITION);
    }
    // Inflate the layout for this fragment and return
    return inflater.inflate(R.layout.movie_detail, container, false);
}

[Buggy Hunk]
mCurrentPosition = savedInstanceState.getInt(ARG_POSITION);

[Patch]
MainActivity.mLastSelected = savedInstanceState.getInt(ARG_POSITION);

[Demonstration 2]

[Buggy Method]
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null && !defaults) {
        if (savedInstanceState.getBoolean(BOTTOM_BAR_SHOWING)) {
            bottomBar.show();
        } else {
            bottomBar.hide();
        }
        firstTimeLoading = savedInstanceState.getBoolean(FIRST_TIME_LOADING);
    }
}

[Buggy Hunk]
if (savedInstanceState != null && !defaults) {

[Patch]
if (savedInstanceState != null && !defaults && bottomBar != null) {

[Demonstration 3]

[Buggy Method]
public void onSaveInstanceState(Bundle outState) {
    mIsDestroyedBySystem = true;
    outState.putLong(KEY_PRESENTER_ID, mPresenterId);
    ViewStateCache cache = mViewStateCacheRef.get();
    if (cache != null)
        cache.saveViewStateData(mViewState);
}

[Buggy Hunk]
outState.putLong(KEY_PRESENTER_ID, mPresenterId);

[Patch]
outState.putInt(KEY_PRESENTER_ID, mPresenterId);