1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-26 14:21:16 +00:00

Fix NPE during addDeviceViewAndSetListener#deviceView.setChecked (#1153)

This commit is contained in:
Catfriend1 2018-06-17 23:32:57 +02:00 committed by Audrius Butkevicius
parent 9ecc9d79d8
commit 73e32ce5d0

View file

@ -480,6 +480,7 @@ public class FolderActivity extends SyncthingActivity
private void addDeviceViewAndSetListener(Device device, LayoutInflater inflater) { private void addDeviceViewAndSetListener(Device device, LayoutInflater inflater) {
inflater.inflate(R.layout.item_device_form, mDevicesContainer); inflater.inflate(R.layout.item_device_form, mDevicesContainer);
SwitchCompat deviceView = (SwitchCompat) mDevicesContainer.getChildAt(mDevicesContainer.getChildCount()-1); SwitchCompat deviceView = (SwitchCompat) mDevicesContainer.getChildAt(mDevicesContainer.getChildCount()-1);
deviceView.setOnCheckedChangeListener(null);
deviceView.setChecked(mFolder.getDevice(device.deviceID) != null); deviceView.setChecked(mFolder.getDevice(device.deviceID) != null);
deviceView.setText(device.getDisplayName()); deviceView.setText(device.getDisplayName());
deviceView.setTag(device); deviceView.setTag(device);