From f9449542ced289325294954eb9fdab1982e6d11d Mon Sep 17 00:00:00 2001
From: Guillaume Heurtier <guillaume.heurtier@maarch.org>
Date: Mon, 17 Feb 2020 12:28:46 +0100
Subject: [PATCH] FEAT #13199 TIME 0:05 fix missing condition

---
 src/app/contact/controllers/ContactController.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/app/contact/controllers/ContactController.php b/src/app/contact/controllers/ContactController.php
index 9fa3b054c84..93ea39f44a8 100755
--- a/src/app/contact/controllers/ContactController.php
+++ b/src/app/contact/controllers/ContactController.php
@@ -468,7 +468,9 @@ class ContactController
                     'data'    => [$resourcesContact['res_id'], $queryParams['redirect'], $resourcesContact['mode']],
                     'orderBy' => ['id desc']
                 ]);
-                $toDelete[] = $resContact[0]['id'];
+                if (count($resContact) > 1) {
+                    $toDelete[] = $resContact[0]['id'];
+                }
             }
             if (!empty($toDelete)) {
                 ResourceContactModel::delete([
-- 
GitLab