ankidroid/Anki-Android — pull request #46 by hssm (2013-05-05 16:53:30+00:00)
Title: Always replace fragment content on deck selection.

Possible fix for [Issue 1634](https://code.google.com/p/ankidroid/issues/detail?id=1634)

This crash happens after syncing when there is no content loaded in the fragment on the right in the tablet view. AnkiDroid will try to update some objects inside the fragment after syncing but will crash since those objects are null.

The fragment is not loaded under certain conditions when opening AnkiDroid. I traced it to [this line](https://github.com/ankidroid/Anki-Android/blob/v2.1-dev/src/com/ichi2/anki/DeckPicker.java#L2182). For the fix, I removed this condition entirely. I don't think it is achieving anything. Here's my reasoning:

Below it, we are creating a new instance of ```StudyOptionsFragment``` and then [replacing everything in the container with the new instance](http://developer.android.com/reference/android/support/v4/app/FragmentTransaction.html#replace(int, android.support.v4.app.Fragment, java.lang.String\)). So the state of the existing fragment is irrelevant and we don't need to check it.

The third condition seems to be trying to avoid updating the fragment if it's the same deck, but this bug shows we can't rely on this method. Perhaps there is a better way for this one (or it just may not be worth it).