Merge pull request #5006 from BallisticLingonberries/fix-pushbullet

Fix storing invalid/deleted pushbullet devices
This commit is contained in:
Jaex 2020-08-31 07:55:45 +03:00 committed by GitHub
commit 2e35136f53
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -181,7 +181,7 @@ public List<PushbulletDevice> GetDeviceList()
PushbulletResponseDevices devicesResponse = JsonConvert.DeserializeObject<PushbulletResponseDevices>(response);
if (devicesResponse != null && devicesResponse.devices != null)
return devicesResponse.devices.Select(x => new PushbulletDevice { Key = x.iden, Name = x.nickname }).ToList();
return devicesResponse.devices.Where(x => !String.IsNullOrEmpty(x.nickname)).Select(x1 => new PushbulletDevice { Key = x1.iden, Name = x1.nickname }).ToList();
return new List<PushbulletDevice>();
}

View file

@ -799,7 +799,8 @@ public void PushbulletGetDevices()
Config.PushbulletSettings.DeviceList.ForEach(pbDevice =>
{
cboPushbulletDevices.Items.Add(pbDevice.Name ?? Resources.UploadersConfigForm_LoadSettings_Invalid_device_name);
if (!String.IsNullOrEmpty(pbDevice.Name))
cboPushbulletDevices.Items.Add(pbDevice.Name);
});
cboPushbulletDevices.SelectedIndex = 0;