From 548ca4c76592d9137bdff909bfebdd9dc9ac9592 Mon Sep 17 00:00:00 2001
From: Etienne LOUPIAS <eloupias@grandlyon.com>
Date: Tue, 1 Mar 2022 16:05:08 +0100
Subject: [PATCH] fix no headline

---
 src/app/post/components/post-list/post-list.component.ts | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/app/post/components/post-list/post-list.component.ts b/src/app/post/components/post-list/post-list.component.ts
index 421502dac..b0ced879b 100644
--- a/src/app/post/components/post-list/post-list.component.ts
+++ b/src/app/post/components/post-list/post-list.component.ts
@@ -66,8 +66,10 @@ export class PostListComponent implements OnInit {
       post.tags.some((tag) => tag && tag.slug === TagEnum.aLaUne)
     );
 
-    const headIndex = this.allPosts.findIndex((post) => post.id === headLineTag[0].id);
-    this.allPosts.splice(headIndex, 1);
+    if (headLineTag.length) {
+      const headIndex = this.allPosts.findIndex((post) => post.id === headLineTag[0].id);
+      this.allPosts.splice(headIndex, 1);
+    }
 
     this.allPosts = [...headLineTag, ..._.difference(this.allPosts, headLineTag)];
   }
-- 
GitLab