Merge "Fix a NPE when highlighting fingerprint row."

This commit is contained in:
TreeHugger Robot
2018-05-24 21:44:50 +00:00
committed by Android (Google) Code Review

View File

@@ -605,6 +605,10 @@ public class FingerprintSettings extends SubSettings {
final Drawable highlight = getHighlightDrawable(); final Drawable highlight = getHighlightDrawable();
if (highlight != null && fpref != null) { if (highlight != null && fpref != null) {
final View view = fpref.getView(); final View view = fpref.getView();
if (view == null) {
// FingerprintPreference is not bound to UI yet, so view is null.
return;
}
final int centerX = view.getWidth() / 2; final int centerX = view.getWidth() / 2;
final int centerY = view.getHeight() / 2; final int centerY = view.getHeight() / 2;
highlight.setHotspot(centerX, centerY); highlight.setHotspot(centerX, centerY);