getGroupNames: Short circuit if no group selected

2796d5dcde6eea470f5b40663e0a9cf914fe8e27

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +4 -1Ignore whitespace
public/scripts/group-chats.js+4 -1
@@ -280,7 +280,10 @@ export function getGroupMembers(groupId = selected_group) {
280280 * @returns {string[]} An array of character names representing the members of the group.
281281 */
282282export function getGroupNames() {
283- const groupMembers = selected_group ? groups.find(x => x.id == selected_group)?.members : null;
283+ if (!selected_group) {
284+ return [];
285+ }
286+ const groupMembers = groups.find(x => x.id == selected_group)?.members;
284287 return Array.isArray(groupMembers)
285288 ? groupMembers.map(x => characters.find(y => y.avatar === x)?.name).filter(x => x)
286289 : [];