Buggy code:
public static final int CONTENT_CONGRATS = 1 ; private static final int NEW_CARD_COUNT_TRUNCATE_THRESHOLD = 1000 ; private int mCurrentContentView = StudyOptionsFragment . CONTENT_STUDY_OPTIONS ; boolean mInvertedColors = false ; private StyledProgressDialog mProgressDialog ; private View mStudyOptionsView ; private View mDeckInfoLayout ; private Button mButtonStart ; private Button mButtonCustomStudy ; private Button mButtonUnbury ; private TextView mTextDeckName ; private TextView mTextDeckDescription ; private TextView mTextTodayNew ; private TextView mTextTodayLrn ; private TextView mTextTodayRev ; private TextView mTextNewTotal ; private TextView mTextTotal ; private TextView mTextETA ; private LinearLayout mSmallChart ; private LinearLayout mDeckCounts ; private LinearLayout mDeckChart ; private Button mDeckOptions ; private Button mCramOptions ; private TextView mTextCongratsMessage ; private View mCongratsLayout ; private String mSearchTerms ; public Bundle mCramInitialConfig = null ; private boolean mFragmented ; private Collection mCollection ; private StyledOpenCollectionDialog mOpenCollectionDialog ; private Thread mFullNewCountThread = null ; public interface StudyOptionsListener { public void refreshMainInterface ( ) { } public void createFilteredDeck ( JSONArray delays , Object [ ] terms , Boolean resched ) ; } private OnClickListener mButtonClickListener = new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { } } ; private void openCramDeckOptions ( ) { } private void openCramDeckOptions ( Bundle initialConfig ) { } private void rebuildCramDeck ( ) { } public static StudyOptionsFragment newInstance ( long deckId , Bundle cramInitialConfig ) { } public long getShownIndex ( ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) { } private void onCollectionLoaded ( Collection col ) { } @ Override public void onDestroy ( ) { } @ Override public void onResume ( ) { } private void closeStudyOptions ( int result ) { } private void openReviewer ( ) { } private void addNote ( ) { } private void animateLeft ( ) { } private void initAllContentViews ( ) { } private void showCustomStudyContextMenu ( ) { } public void createFilteredDeck ( JSONArray delays , Object [ ] terms , Boolean resched ) { JSONObject dyn ; if ( colOpen ( ) ) { Collection col = getCol ( ) ; try { String deckName = col . getDecks ( ) . current ( ) . getString ( "name" ) ; String customStudyDeck = getResources ( ) . getString ( custom_study_deck_name ) ; JSONObject cur = col . getDecks ( ) . byName ( customStudyDeck ) ; if ( cur != null ) { if ( ( cur . getInt ( "dyn" ) ) != 1 ) { StyledDialog . Builder builder = new StyledDialog . Builder ( getActivity ( ) ) ; builder . setMessage ( custom_study_deck_exists ) ; builder . setNegativeButton ( getResources ( ) . getString ( dialog_cancel ) , new OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { } } ) ; builder . create ( ) . show ( ) ; return ; } else { col . getSched ( ) . emptyDyn ( cur . getLong ( "id" ) ) ; dyn = cur ; col . getDecks ( ) . select ( cur . getLong ( "id" ) ) ; } } else { long did = col . getDecks ( ) . newDyn ( customStudyDeck ) ; dyn = col . getDecks ( ) . get ( did ) ; } if ( ( delays . length ( ) ) > 0 ) { dyn . put ( "delays" , delays ) ; } else { <START_BUG> dyn . remove ( "delays" ) ; <END_BUG> } JSONArray ar = dyn . getJSONArray ( "terms" ) ; ar . getJSONArray ( 0 ) . put ( 0 , new StringBuilder ( "deck:\"" ) . append ( deckName ) . append ( "\"<seq2seq4repair_space>" ) . append ( terms [ 0 ] ) . toString ( ) ) ; ar . getJSONArray ( 0 ) . put ( 1 , terms [ 1 ] ) ; ar . getJSONArray ( 0 ) . put ( 2 , terms [ 2 ] ) ; dyn . put ( "resched" , resched ) ; mProgressDialog = StyledProgressDialog . show ( getActivity ( ) , "" , getResources ( ) . getString ( rebuild_custom_study_deck ) , true ) ; DeckTask . launchDeckTask ( TASK_TYPE_REBUILD_CRAM , getDeckTaskListener ( true ) , new DeckTask . TaskData ( getCol ( ) , getCol ( ) . getDecks ( ) . selected ( ) , mFragmented ) ) ; } catch ( JSONException e ) { throw new RuntimeException ( e ) ; } } } void setFragmentContentView ( View newView ) { } public void resetAndRefreshInterface ( ) { } private void resetAndRefreshInterface ( boolean updateDeckList ) { } private void refreshInterface ( ) { } private void refreshInterface ( boolean reset , boolean updateDeckList ) { } private void updateChart ( double [ ] [ ] serieslist ) { } @ Override public void onCreateOptionsMenu ( Menu menu , MenuInflater inflater ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } @ Override public void onActivityResult ( int requestCode , int resultCode , Intent intent ) { } private void dismissProgressDialog ( ) { } public SharedPreferences restorePreferences ( ) { } private TaskListener getDeckTaskListener ( boolean updateDeckList ) { } TaskListener mRefreshWholeInterfaceListener = new DeckTask . TaskListener ( ) { @ Override public void onPostExecute ( TaskData result ) { } @ Override public void onPreExecute ( ) { } @ Override public void onProgressUpdate ( TaskData ... values ) { } @ Override public void onCancelled ( ) { } } ; TaskListener mRefreshFragmentListener = new DeckTask . TaskListener ( ) { @ Override public void onPostExecute ( DeckTask . TaskData result ) { } @ Override public void onPreExecute ( ) { } @ Override public void onProgressUpdate ( DeckTask ... values ) { } @ Override public void onCancelled ( ) { } } ;

Fix:
dyn . put ( "delays" , NULL ) ;