From 1daa35f9d71fa6b04749b84a0fd63b375bba1f43 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi <256895@studenti.unimore.it> Date: Fri, 30 Apr 2021 15:53:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Disallow=20adding=20empty=20cond?= =?UTF-8?q?itions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/interactive/BoxConditionHashtag.js | 6 ++++++ .../frontend/src/components/interactive/BoxConditionUser.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/code/frontend/src/components/interactive/BoxConditionHashtag.js b/code/frontend/src/components/interactive/BoxConditionHashtag.js index a234e24..b1a5dc6 100644 --- a/code/frontend/src/components/interactive/BoxConditionHashtag.js +++ b/code/frontend/src/components/interactive/BoxConditionHashtag.js @@ -37,6 +37,12 @@ export default function BoxConditionHashtag({ ...props }) { "type": 0, "content": hashtag } + + if(hashtag === "") { + console.debug("Refusing to append ", newCond, " to the Conditions list, as it is empty.") + return + } + let duplicate = null; for(const oldCond of conditions) { if(newCond.type === oldCond.type && newCond.content === oldCond.content) { diff --git a/code/frontend/src/components/interactive/BoxConditionUser.js b/code/frontend/src/components/interactive/BoxConditionUser.js index cc38959..8a89d2b 100644 --- a/code/frontend/src/components/interactive/BoxConditionUser.js +++ b/code/frontend/src/components/interactive/BoxConditionUser.js @@ -36,6 +36,12 @@ export default function BoxConditionUser({ ...props }) { "type": 3, "content": user } + + if(user === "") { + console.debug("Refusing to append ", newCond, " to the Conditions list, as it is empty.") + return + } + let duplicate = null; for(const oldCond of conditions) { if(newCond.type === oldCond.type && newCond.content === oldCond.content) {