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 421502dacc4731cf265da1beebafa2bed3151c43..b0ced879b3722c795d30969a6b11c24c7b7e265c 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)]; }