From 19002ea033147ff6d155c4f39810bc543c005d30 Mon Sep 17 00:00:00 2001 From: Matt LaPaglia Date: Sat, 2 Jan 2021 18:08:08 -0600 Subject: [PATCH] Don't bomb with missing make/model (#11) * don't bomb on missing makemodel * this too --- OpenAlprWebhookProcessor/WebhookProcessor/WebhookHandler.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenAlprWebhookProcessor/WebhookProcessor/WebhookHandler.cs b/OpenAlprWebhookProcessor/WebhookProcessor/WebhookHandler.cs index 4acec0df..c8f34a2a 100644 --- a/OpenAlprWebhookProcessor/WebhookProcessor/WebhookHandler.cs +++ b/OpenAlprWebhookProcessor/WebhookProcessor/WebhookHandler.cs @@ -25,9 +25,13 @@ public void Handle(OpenAlprWebhook webhook) OpenAlprCameraId = webhook.CameraId, OpenAlprProcessingTimeMs = Math.Round(webhook.BestPlate.ProcessingTimeMs, 2), ProcessedPlateConfidence = Math.Round(webhook.BestPlate.Confidence, 2), - VehicleDescription = $"{webhook.Vehicle.Year[0]?.Name} {FormatVehicleDescription(webhook.Vehicle.MakeModel[0]?.Name)}", }; + if (webhook.Vehicle.MakeModel.Count > 0) + { + updateRequest.VehicleDescription = $"{webhook.Vehicle.Year[0].Name} {FormatVehicleDescription(webhook.Vehicle.MakeModel[0].Name)}"; + } + _cameraUpdateService.AddJob(updateRequest); }