From ff4491d7e3801cb5f4621fa26c6ead90cf0b27c8 Mon Sep 17 00:00:00 2001 From: metal Date: Wed, 23 Nov 2022 11:32:32 +0000 Subject: [PATCH] missing safety nulls on set_counter fn Signed-off-by: GitHub --- backend/src/plugins/Counters/functions/setCounterValue.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/plugins/Counters/functions/setCounterValue.ts b/backend/src/plugins/Counters/functions/setCounterValue.ts index 7a988ee2..55b6f78f 100644 --- a/backend/src/plugins/Counters/functions/setCounterValue.ts +++ b/backend/src/plugins/Counters/functions/setCounterValue.ts @@ -25,6 +25,9 @@ export async function setCounterValue( throw new Error(`Counter is per user but no user ID was supplied`); } + channelId = counter.per_channel ? channelId : null; + userId = counter.per_user ? userId : null; + const counterId = pluginData.state.counterIds[counterName]; const lock = await pluginData.locks.acquire(counterIdLock(counterId));