Fixed a Null Pointer Error in Bluetooth Settings.

+ The root of the problem is that the callback for a device change may be
set before the fragment has a layout.  Then if a change does come in,
getView() would return null.  This fix delays registering the callback
until appropiate.

Bug: 17404518
Change-Id: Ibd0e90f82593d45729f427bcc2e40fe9195eb42a
This commit is contained in:
PauloftheWest
2014-09-09 10:04:46 -07:00
parent 574db42695
commit c009b8a496

View File

@@ -132,8 +132,8 @@ public final class DeviceProfilesSettings extends SettingsPreferenceFragment
public void setDevice(CachedBluetoothDevice cachedDevice) { public void setDevice(CachedBluetoothDevice cachedDevice) {
mCachedDevice = cachedDevice; mCachedDevice = cachedDevice;
mCachedDevice.registerCallback(this);
if (isResumed()) { if (isResumed()) {
mCachedDevice.registerCallback(this);
addPreferencesForProfiles(); addPreferencesForProfiles();
refresh(); refresh();
} }