Skip to content

Commit

Permalink
fix #102 - Check if device model is present before requesting the cur…
Browse files Browse the repository at this point in the history
…rent device model (#105)
  • Loading branch information
kbeaugrand authored Jan 26, 2022
1 parent 2e60553 commit e246d2f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,11 @@
Device = await Http.GetFromJsonAsync<DeviceDetails>($"api/Devices/{DeviceID}");

// Gets the DeviceModel Name from the DeviceModel ID
DeviceModel model = await Http.GetFromJsonAsync<DeviceModel>($"api/DeviceModels/{Device.ModelId}");
Device.ModelName = model.Name;
if (!string.IsNullOrEmpty(Device.ModelId))
{
DeviceModel model = await Http.GetFromJsonAsync<DeviceModel>($"api/DeviceModels/{Device.ModelId}");
Device.ModelName = model?.Name;
}

// StatusUpdatedTime set to string to have a more human-readable format
StatusUpdatedTimeString = Device.StatusUpdatedTime.ToString();
Expand Down

0 comments on commit e246d2f

Please sign in to comment.