Program: 14975
Project: 14975
Buggy source:
public void refreshMediaFromServer(int offset,final boolean auto){
  if (WordPress.getCurrentBlog() == null || mFilter == Filter.CUSTOM_DATE)   return;
  if (mSearchTerm != null && mSearchTerm.length() > 0)   return;
  if (offset == 0 || !mIsRefreshing) {
    if (offset == mOldMediaSyncOffset) {
      offset=0;
    }
    mOldMediaSyncOffset=offset;
    mIsRefreshing=true;
    mListener.onMediaItemListDownloadStart();
    mGridAdapter.setRefreshing(true);
    List<Object> apiArgs=new ArrayList<Object>();
    apiArgs.add(WordPress.getCurrentBlog());
    Callback callback=new Callback(){
      @Override public void onSuccess(      int count){
        MediaGridAdapter adapter=(MediaGridAdapter)mGridView.getAdapter();
        mHasRetrievedAllMedia=(count == 0);
        adapter.setHasRetrieviedAll(mHasRetrievedAllMedia);
        mIsRefreshing=false;
        if (getActivity() != null && MediaGridFragment.this.isVisible()) {
          getActivity().runOnUiThread(new Runnable(){
            @Override public void run(){
              refreshSpinnerAdapter();
              setFilter(mFilter);
              if (!auto)               mGridView.setSelection(0);
              mListener.onMediaItemListDownloaded();
              mGridAdapter.setRefreshing(false);
            }
          }
);
        }
      }
      @Override public void onFailure(      int errorCode){
        if (errorCode == SyncMediaLibraryTask.NO_UPLOAD_FILES_CAP) {
          Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          MediaGridAdapter adapter=(MediaGridAdapter)mGridView.getAdapter();
          mHasRetrievedAllMedia=true;
          adapter.setHasRetrieviedAll(mHasRetrievedAllMedia);
        }
        if (getActivity() != null && MediaGridFragment.this.isVisible()) {
          getActivity().runOnUiThread(new Runnable(){
            @Override public void run(){
              mIsRefreshing=false;
              mListener.onMediaItemListDownloaded();
              mGridAdapter.setRefreshing(false);
            }
          }
);
        }
      }
    }
;
    ApiHelper.SyncMediaLibraryTask getMediaTask=new ApiHelper.SyncMediaLibraryTask(offset,mFilter,callback);
    getMediaTask.execute(apiArgs);
  }
}

Fixed version (ground truth):
public void refreshMediaFromServer(int offset,final boolean auto){
  if (WordPress.getCurrentBlog() == null || mFilter == Filter.CUSTOM_DATE)   return;
  if (mSearchTerm != null && mSearchTerm.length() > 0)   return;
  if (offset == 0 || !mIsRefreshing) {
    if (offset == mOldMediaSyncOffset) {
      offset=0;
    }
    mOldMediaSyncOffset=offset;
    mIsRefreshing=true;
    mListener.onMediaItemListDownloadStart();
    mGridAdapter.setRefreshing(true);
    List<Object> apiArgs=new ArrayList<Object>();
    apiArgs.add(WordPress.getCurrentBlog());
    Callback callback=new Callback(){
      @Override public void onSuccess(      int count){
        MediaGridAdapter adapter=(MediaGridAdapter)mGridView.getAdapter();
        mHasRetrievedAllMedia=(count == 0);
        adapter.setHasRetrieviedAll(mHasRetrievedAllMedia);
        mIsRefreshing=false;
        if (getActivity() != null && MediaGridFragment.this.isVisible()) {
          getActivity().runOnUiThread(new Runnable(){
            @Override public void run(){
              refreshSpinnerAdapter();
              setFilter(mFilter);
              if (!auto)               mGridView.setSelection(0);
              mListener.onMediaItemListDownloaded();
              mGridAdapter.setRefreshing(false);
            }
          }
);
        }
      }
      @Override public void onFailure(      int errorCode){
        if (errorCode == SyncMediaLibraryTask.NO_UPLOAD_FILES_CAP || errorCode == SyncMediaLibraryTask.UNKNOWN_ERROR) {
          String errorMessage=errorCode == SyncMediaLibraryTask.NO_UPLOAD_FILES_CAP ? "String_Node_Str" : "String_Node_Str";
          Toast.makeText(getActivity(),errorMessage,Toast.LENGTH_SHORT).show();
          MediaGridAdapter adapter=(MediaGridAdapter)mGridView.getAdapter();
          mHasRetrievedAllMedia=true;
          adapter.setHasRetrieviedAll(mHasRetrievedAllMedia);
        }
        if (getActivity() != null && MediaGridFragment.this.isVisible()) {
          getActivity().runOnUiThread(new Runnable(){
            @Override public void run(){
              mIsRefreshing=false;
              mListener.onMediaItemListDownloaded();
              mGridAdapter.setRefreshing(false);
            }
          }
);
        }
      }
    }
;
    ApiHelper.SyncMediaLibraryTask getMediaTask=new ApiHelper.SyncMediaLibraryTask(offset,mFilter,callback);
    getMediaTask.execute(apiArgs);
  }
}