From 0074324b107c1736914c20f570258b474e4caadb Mon Sep 17 00:00:00 2001
From: Fabien O'Carroll <fabien@allou.is>
Date: Tue, 30 Jun 2020 18:29:52 +0200
Subject: [PATCH] Fixed migration when brand setting is null

refs #10318

This would throw if the setting was null, we catch and use the default
instead.
---
 .../migrations/versions/3.22/02-settings-key-renames.js     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/server/data/migrations/versions/3.22/02-settings-key-renames.js b/core/server/data/migrations/versions/3.22/02-settings-key-renames.js
index b16910366e..4d446559fd 100644
--- a/core/server/data/migrations/versions/3.22/02-settings-key-renames.js
+++ b/core/server/data/migrations/versions/3.22/02-settings-key-renames.js
@@ -16,7 +16,11 @@ const renameMappings = [{
     from: 'brand',
     to: 'accent_color',
     getToValue: (fromValue) => {
-        return JSON.parse(fromValue).primaryColor || '';
+        try {
+            return JSON.parse(fromValue).primaryColor || '';
+        } catch (err) {
+            return '';
+        }
     },
     getFromValue: (toValue) => {
         return JSON.stringify({