diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs index 70a04d249..6d324b1ab 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs @@ -60,6 +60,12 @@ namespace MediaBrowser.Server.Implementations.Devices public Task SaveCapabilities(string reportedId, ClientCapabilities capabilities) { var device = GetDevice(reportedId); + + if (device == null) + { + throw new ArgumentException("No device has been registed with id " + reportedId); + } + device.Capabilities = capabilities; SaveDevice(device); @@ -75,6 +81,11 @@ namespace MediaBrowser.Server.Implementations.Devices public DeviceInfo GetDevice(string id) { + if (string.IsNullOrWhiteSpace(id)) + { + throw new ArgumentNullException("id"); + } + return GetDevices() .FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase)); } |
