From c4adff4a2d525f5bac6e48e3b465ca1245b70ef6 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Mon, 24 Oct 2016 18:24:32 +0200 Subject: [PATCH] avoid exception if missing strategy --- packages/unleash-api/lib/helper/legacy-feature-mapper.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/unleash-api/lib/helper/legacy-feature-mapper.js b/packages/unleash-api/lib/helper/legacy-feature-mapper.js index 36d25a0659..e67b7aeba5 100644 --- a/packages/unleash-api/lib/helper/legacy-feature-mapper.js +++ b/packages/unleash-api/lib/helper/legacy-feature-mapper.js @@ -6,8 +6,10 @@ function addOldFields (feature) { modifiedFeature.strategies = []; return modifiedFeature; } - modifiedFeature.strategy = feature.strategies[0].name; - modifiedFeature.parameters = Object.assign({}, feature.strategies[0].parameters); + if (feature.strategies[0]) { + modifiedFeature.strategy = feature.strategies[0].name; + modifiedFeature.parameters = Object.assign({}, feature.strategies[0].parameters); + } return modifiedFeature; }