summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/tts
diff options
context:
space:
mode:
authortiansiming <tiansiming@xiaomi.com>2017-12-06 21:29:15 +0800
committertiansiming <tiansiming@xiaomi.com>2017-12-07 10:08:34 +0800
commitb65c4c3e254077a11e2b4e84039ee59271c20cee (patch)
treecc368480ec1fd21f739e9465c428145650441d23 /src/com/android/settings/tts
parent9afa720abe19e7bea08cc84426a80b1946c7ce3d (diff)
downloadpackages_apps_Settings-b65c4c3e254077a11e2b4e84039ee59271c20cee.tar.gz
packages_apps_Settings-b65c4c3e254077a11e2b4e84039ee59271c20cee.tar.bz2
packages_apps_Settings-b65c4c3e254077a11e2b4e84039ee59271c20cee.zip
Fix NPE when press ttsEngines settings icon
settingsIntent is obtained by method getSettingsIntent in TtsEngines.java, and it has the chance to return null directly in which case will lead to NPE crash when we startActivity in TextToSpeechSettings.java with a null intent. So, a judgement here makes sense. Bug:https://issuetracker.google.com/issues/70266990 Test: 1) Install the apk "partner-BaiduSpeechService.apk" offered in the Bug link above. 2) Go to Settings -> Languages & input -> Advance -> Text-to-speech output 3) Choose "Duer voice engine 3.0" as the preferred engine 4) Press the settings icon in the right Change-Id: I497a745ce62989f3ff1aee661648e90af25fb99e Signed-off-by: tiansiming <tiansiming@xiaomi.com>
Diffstat (limited to 'src/com/android/settings/tts')
-rw-r--r--src/com/android/settings/tts/TextToSpeechSettings.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/settings/tts/TextToSpeechSettings.java b/src/com/android/settings/tts/TextToSpeechSettings.java
index e8823a6388..c566967637 100644
--- a/src/com/android/settings/tts/TextToSpeechSettings.java
+++ b/src/com/android/settings/tts/TextToSpeechSettings.java
@@ -777,7 +777,11 @@ public class TextToSpeechSettings extends SettingsPreferenceFragment
if (KEY_TTS_ENGINE_PREFERENCE.equals(p.getKey())) {
EngineInfo info = mEnginesHelper.getEngineInfo(mCurrentEngine);
final Intent settingsIntent = mEnginesHelper.getSettingsIntent(info.name);
- startActivity(settingsIntent);
+ if (settingsIntent != null) {
+ startActivity(settingsIntent);
+ } else {
+ Log.e(TAG, "settingsIntent is null");
+ }
}
}