From b71846e3c945a3033b5728c8f05cabafe4c8d33d Mon Sep 17 00:00:00 2001 From: Le Chau Date: Thu, 25 Jun 2020 10:42:26 +0700 Subject: [PATCH] =?UTF-8?q?Check=20vehice=20=3D=3D=20null=20khi=20api=20tr?= =?UTF-8?q?=E1=BA=A3=20v=E1=BB=81=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AIParkingApplication/Statistic.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AIParkingApplication/Statistic.cs b/AIParkingApplication/Statistic.cs index c63b46d..67642f3 100644 --- a/AIParkingApplication/Statistic.cs +++ b/AIParkingApplication/Statistic.cs @@ -44,6 +44,10 @@ namespace AIParkingApplication HttpResponseMessage response = await client.GetAsync("/api/statistics"); response.EnsureSuccessStatusCode(); var vehicle = await response.Content.ReadAsAsync(); + if(vehicle == null) + { + return; + } lblSoLuongXeMay.Invoke(new Action(() => { lblSoLuongXeMay.Text = vehicle.NumberOfMoto.ToString();