From c7be810e65dc3ec16b918eb12b1e62c62971e174 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Wed, 31 Jul 2019 11:00:44 -0600 Subject: [PATCH] Appease the tests --- src/pushprocessor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/pushprocessor.js b/src/pushprocessor.js index 550f71786..0cf05cacf 100644 --- a/src/pushprocessor.js +++ b/src/pushprocessor.js @@ -468,7 +468,13 @@ PushProcessor.actionListToActionsObject = function(actionlist) { * @returns {object} The rewritten rules */ PushProcessor.rewriteDefaultRules = function(incomingRules) { - const newRules = JSON.parse(JSON.stringify(incomingRules)); // deep clone + let newRules = JSON.parse(JSON.stringify(incomingRules)); // deep clone + + // These lines are mostly to make the tests happy. We shouldn't run into these + // properties missing in practice. + if (!newRules) newRules = {}; + if (!newRules.global) newRules.global = {}; + if (!newRules.global.override) newRules.global.override = []; // Fix default override rules newRules.global.override = newRules.global.override.map(r => {