diff --git a/src/lib/group/MemberEdit.svelte b/src/lib/group/MemberEdit.svelte index a1dc8673..8a6f1393 100644 --- a/src/lib/group/MemberEdit.svelte +++ b/src/lib/group/MemberEdit.svelte @@ -42,9 +42,9 @@ $: indexOfLastItem = currentPage * 10; $: indexOfFirstItem = indexOfLastItem - 10; - $: pageAmount = Math.ceil(membersInGroup.length / 10); + $: pageAmount = Math.ceil(membersInGroup && membersInGroup.length / 10); - $: finalMemberList = membersInGroup.slice(indexOfFirstItem, indexOfLastItem); + $: finalMemberList = membersInGroup && membersInGroup.slice(indexOfFirstItem, indexOfLastItem); let settings = JSON.parse(localStorage.getItem('pk-settings')); let listGroupElements: any[] = []; @@ -114,7 +114,7 @@ function memberListRenderer(item: any) { Current Members - {#if finalMemberList.length > 0} + {#if finalMemberList && finalMemberList.length > 0} {#each finalMemberList as member, index (member.id)} {member.name} ({member.id}) {member.display_name ? `${member.display_name}` : ""} diff --git a/src/lib/member/GroupEdit.svelte b/src/lib/member/GroupEdit.svelte index 1832c5ec..969557a1 100644 --- a/src/lib/member/GroupEdit.svelte +++ b/src/lib/member/GroupEdit.svelte @@ -43,9 +43,9 @@ $: indexOfLastItem = currentPage * 10; $: indexOfFirstItem = indexOfLastItem - 10; - $: pageAmount = Math.ceil(groupsWithMember.length / 10); + $: pageAmount = Math.ceil(groupsWithMember && groupsWithMember.length / 10); - $: finalGroupsList = groupsWithMember.slice(indexOfFirstItem, indexOfLastItem); + $: finalGroupsList = groupsWithMember && groupsWithMember.slice(indexOfFirstItem, indexOfLastItem); let settings = JSON.parse(localStorage.getItem('pk-settings')); let listGroupElements: any[] = []; @@ -115,7 +115,7 @@ Current Groups - {#if finalGroupsList.length > 0} + {#if finalGroupsList && finalGroupsList.length > 0} {#each finalGroupsList as group, index (group.id)} {group.name} ({group.id}) {@html group.display_name ? `${toHTML(group.display_name)}` : ""}