From 04cf2277d9ebf4bd582c99a05e5ebe19229a4568 Mon Sep 17 00:00:00 2001 From: Nachtalb Date: Wed, 5 May 2021 18:09:18 +0200 Subject: [PATCH] Prevent possible error when findChannel can't find the wanted channel Using ?. (optional chaining) requires ecma version 2020 as it is fairly new. Webpack / Babel can handle it. --- .eslintrc.yml | 2 +- client/js/socket-events/more.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index b67991b5..d59c3b80 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -2,7 +2,7 @@ root: true parserOptions: - ecmaVersion: 2018 + ecmaVersion: 2020 env: es6: true diff --git a/client/js/socket-events/more.js b/client/js/socket-events/more.js index ee864895..34abf2c5 100644 --- a/client/js/socket-events/more.js +++ b/client/js/socket-events/more.js @@ -6,7 +6,7 @@ import socket from "../socket"; import store from "../store"; socket.on("more", function (data) { - const channel = store.getters.findChannel(data.chan).channel; + const channel = store.getters.findChannel(data.chan)?.channel; if (!channel) { return;