diff --git a/package.json b/package.json index 3c1a850..2497f30 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "townsquare", - "version": "1.2.0", + "version": "1.2.1", "description": "Blood on the Clocktower Town Square", "author": "Steffen Baumgart", "scripts": { diff --git a/src/components/modals/EditionModal.vue b/src/components/modals/EditionModal.vue index 7c99380..adca090 100644 --- a/src/components/modals/EditionModal.vue +++ b/src/components/modals/EditionModal.vue @@ -116,7 +116,13 @@ export default { if (file && file.size) { const reader = new FileReader(); reader.addEventListener("load", () => { - this.parseRoles(JSON.parse(reader.result)); + try { + const roles = JSON.parse(reader.result); + this.parseRoles(roles); + } catch (e) { + alert("Error reading custom script: " + e.message); + } + this.$refs.upload.value = ""; }); reader.readAsText(file); } @@ -130,8 +136,12 @@ export default { async handleURL(url) { const res = await fetch(url); if (res && res.json) { - const script = await res.json(); - this.parseRoles(script); + try { + const script = await res.json(); + this.parseRoles(script); + } catch (e) { + alert("Error loading custom script: " + e.message); + } } }, parseRoles(roles) {