diff --git a/src/stores/zone.ts b/src/stores/zone.ts index ad850be..c3de41d 100644 --- a/src/stores/zone.ts +++ b/src/stores/zone.ts @@ -27,8 +27,12 @@ export const useZoneStore = defineStore('zone', { this.characters = this.characters.filter((c: Character) => c.id !== character.id) }, updateCharacter(character: Character) { - const index = this.characters.findIndex((c: Character) => c.id === character.id) - this.characters[index] = character + const index = this.characters.findIndex((c) => c.id === character.id) + if (index !== -1) { + this.characters[index] = character + } else { + console.error(`Character with id ${character.id} not found`) + } } } })