Fix a pseudo race condition in TtsEngineSettingsFragment.

The issue is that Fragment.setVoiceDataDetails can
be called before Fragment.getView. We guard against this
issue. No thread visibility issues here because both functions
are called on the UI thread.

bug:5884355
Change-Id: Iad91b91c58b04dcb9f34f6b5ff8752f2e8295423
diff --git a/src/com/android/settings/tts/TtsEnginePreference.java b/src/com/android/settings/tts/TtsEnginePreference.java
index b98a239..196882f 100644
--- a/src/com/android/settings/tts/TtsEnginePreference.java
+++ b/src/com/android/settings/tts/TtsEnginePreference.java
@@ -155,12 +155,21 @@
             }
         });
 
+        if (mVoiceCheckData != null) {
+            mSettingsIcon.setEnabled(mRadioButton.isChecked());
+        }
+
         return view;
     }
 
     public void setVoiceDataDetails(Intent data) {
         mVoiceCheckData = data;
-        mSettingsIcon.setEnabled(mRadioButton.isChecked());
+        // This might end up running before getView aboive, in which
+        // case mSettingsIcon && mRadioButton will be null. In this case
+        // getView will set the right values.
+        if (mSettingsIcon != null && mRadioButton != null) {
+            mSettingsIcon.setEnabled(mRadioButton.isChecked());
+        }
     }
 
     private void onRadioButtonClicked(CompoundButton buttonView, boolean isChecked) {