Bug 1263758 - Correct NPE when using a custom search engine as the default r=liuche
MozReview-Commit-ID: hpGUIu9yP2
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3971,17 +3971,17 @@ public class BrowserApp extends GeckoApp
final SharedPreferences sharedPrefs = GeckoSharedPrefs.forProfileName(context, profile.getName());
final int seq = sharedPrefs.getInt(TelemetryConstants.PREF_SEQ_COUNT, 1);
// We store synchronously before sending the Intent to ensure this sequence number will not be re-used.
sharedPrefs.edit().putInt(TelemetryConstants.PREF_SEQ_COUNT, seq + 1).commit();
final Intent i = new Intent(TelemetryConstants.ACTION_UPLOAD_CORE);
i.setClass(context, TelemetryUploadService.class);
- i.putExtra(TelemetryConstants.EXTRA_DEFAULT_SEARCH_ENGINE, defaultEngine.getIdentifier());
+ i.putExtra(TelemetryConstants.EXTRA_DEFAULT_SEARCH_ENGINE, (defaultEngine == null) ? null : defaultEngine.getIdentifier());
i.putExtra(TelemetryConstants.EXTRA_DOC_ID, UUID.randomUUID().toString());
i.putExtra(TelemetryConstants.EXTRA_PROFILE_NAME, profile.getName());
i.putExtra(TelemetryConstants.EXTRA_PROFILE_PATH, profile.getDir().getAbsolutePath());
i.putExtra(TelemetryConstants.EXTRA_SEQ, seq);
context.startService(i);
}
private static class UploadTelemetryCallback implements SearchEngineManager.SearchEngineCallback {