Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java

Issue 894873004: Fix crash on BLU Life Play devices related to switch preferences. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
index f363fa512f467cc72ad6170c40dcca4c2ac7a7b1..e49161927083325eebe77e3ce909b1005efccfa4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromeSwitchPreference.java
@@ -50,8 +50,14 @@ public class ChromeSwitchPreference extends SwitchPreference {
@Override
protected void onBindView(View view) {
super.onBindView(view);
+
ChromeSwitchCompat switchView = (ChromeSwitchCompat) view.findViewById(R.id.switch_widget);
- switchView.setChecked(isChecked());
+ // On BLU Life Play devices SwitchPreference.setWidgetLayoutResource() does nothing. As a
+ // result, the user will see a non-material Switch and switchView will be null, hence the
+ // null check below. http://crbug.com/451447
+ if (switchView != null) {
+ switchView.setChecked(isChecked());
+ }
TextView title = (TextView) view.findViewById(android.R.id.title);
title.setSingleLine(false);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698