diff --git a/AUTHORS.md b/AUTHORS.md index acf0a4bbd..edc560bf1 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -9,6 +9,7 @@ - Christian Kraus - Christoph Wurst - Daniel Kesselberg +- Dominik Kuzila - Gary Kim - Georg Ehrke - Greta Doci diff --git a/src/components/AppNavigation/RootNavigation.vue b/src/components/AppNavigation/RootNavigation.vue index 627fa9ff9..c92d9c42c 100644 --- a/src/components/AppNavigation/RootNavigation.vue +++ b/src/components/AppNavigation/RootNavigation.vue @@ -393,10 +393,14 @@ export default { this.createGroupError = null this.logger.debug('Created new local group', { groupName }) - this.$store.dispatch('addGroup', groupName) - this.isNewGroupMenuOpen = false - emit('contacts:group:append', groupName) + try { + this.$store.dispatch('addGroup', groupName) + this.isNewGroupMenuOpen = false + emit('contacts:group:append', groupName) + } catch (error) { + showError(t('contacts', 'An error occurred while creating the group')) + } }, // Ellipsis item toggles diff --git a/src/store/groups.js b/src/store/groups.js index 4da839e2d..44de3e214 100644 --- a/src/store/groups.js +++ b/src/store/groups.js @@ -184,6 +184,9 @@ const actions = { * @param {string} groupName the name of the group */ addGroup(context, groupName) { + if (!groupName || groupName.trim() === '') { + throw new Error('Group name cannot be empty') + } context.commit('addGroup', groupName) }, }