From 4ed0c4f42b527eb518eb572dd70741ce78313977 Mon Sep 17 00:00:00 2001 From: "Haelwenn (lanodan) Monnier" Date: Fri, 2 Sep 2022 17:51:05 +0200 Subject: [PATCH] normalizers: Fix crash in parseTuples when tuples is empty --- CHANGELOG.md | 1 + src/store/modules/normalizers.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23295d52..b4dc4531 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed ### Fixed +- Crash when parsing tuples in Settings ## [2.4.0] - 2021-08-01 diff --git a/src/store/modules/normalizers.js b/src/store/modules/normalizers.js index d286f379..e93ed1a5 100644 --- a/src/store/modules/normalizers.js +++ b/src/store/modules/normalizers.js @@ -56,6 +56,10 @@ export const parseNonTuples = (key, value) => { } // REFACTOR export const parseTuples = (tuples, key) => { + if (!tuples.reduce) { + console.warn('Got empty tuples with key:', key) + return null + } return tuples.reduce((accum, item) => { if (key === ':rate_limit' || (key === 'Pleroma.Web.Endpoint.MetricsExporter' && item.tuple[0] === ':auth')) {