Check vehice == null khi api trả về null
This commit is contained in:
parent
effa22abc9
commit
b71846e3c9
|
@ -44,6 +44,10 @@ namespace AIParkingApplication
|
||||||
HttpResponseMessage response = await client.GetAsync("/api/statistics");
|
HttpResponseMessage response = await client.GetAsync("/api/statistics");
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
var vehicle = await response.Content.ReadAsAsync<Vehicle>();
|
var vehicle = await response.Content.ReadAsAsync<Vehicle>();
|
||||||
|
if(vehicle == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
lblSoLuongXeMay.Invoke(new Action(() =>
|
lblSoLuongXeMay.Invoke(new Action(() =>
|
||||||
{
|
{
|
||||||
lblSoLuongXeMay.Text = vehicle.NumberOfMoto.ToString();
|
lblSoLuongXeMay.Text = vehicle.NumberOfMoto.ToString();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user