NfcTile: Avoid NPE during boot up phase

* NFC status can't be retrieved before the service starts.

Change-Id: I4bd4fbb5e0d49786edde7ad43a87463e37979774
This commit is contained in:
Bruno Martins
2018-02-01 17:20:39 +00:00
parent 73e7a1a739
commit 53159324bb

View File

@@ -98,6 +98,8 @@ public class NfcTile extends QSTileImpl<BooleanState> {
protected void handleUpdateState(BooleanState state, Object arg) {
final Drawable mEnable = mContext.getDrawable(R.drawable.ic_qs_nfc_enabled);
final Drawable mDisable = mContext.getDrawable(R.drawable.ic_qs_nfc_disabled);
if (getAdapter() == null) return;
state.value = getAdapter().isEnabled();
state.label = mContext.getString(R.string.quick_settings_nfc_label);
state.icon = new DrawableIcon(state.value ? mEnable : mDisable);