- backend.putString(activeDeviceAddressPreference, active_device_address.address);
- backend.putString(activeDeviceNamePreference, active_device_address.name);
+ if (active_device_address != null) {
+ backend.putString(activeDeviceAddressPreference, active_device_address.address);
+ backend.putString(activeDeviceNamePreference, active_device_address.name);
+ } else {
+ backend.remove(activeDeviceAddressPreference);
+ backend.remove(activeDeviceNamePreference);
+ }