From 14f5235dfe6fd50a7cbd123bd55330e636a8bccb Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Mon, 17 Apr 2017 17:29:38 -0500 Subject: [PATCH] Handle undefined --- client/app/scripts/utils/demo-utils.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/app/scripts/utils/demo-utils.js b/client/app/scripts/utils/demo-utils.js index 2640c6095..b3e6b84a2 100644 --- a/client/app/scripts/utils/demo-utils.js +++ b/client/app/scripts/utils/demo-utils.js @@ -18,7 +18,10 @@ function runAction(action, args, dispatch, getState) { } function openNodeDetails(dispatch, getState, run, next) { - const { id, label } = getRandomNode(getState); + const { id, label } = getRandomNode(getState) || {}; + if (!id || !label) { + return; + } run(clickNode, [id, label]); setTimeout(() => { run(clickCloseDetails, [id]); @@ -28,7 +31,10 @@ function openNodeDetails(dispatch, getState, run, next) { function changeTopology(dispatch, getState, run, next) { const blacklist = ['hosts', 'weave', 'containers-by-hostname']; - const { topologies } = getState().toJS(); + const { topologies } = getState().toJS() || {}; + if (!topologies) { + return; + } const subTopologies = _.reduce(topologies, (result, t) => { if (t.sub_topologies) { return result.concat(t.sub_topologies);