Fixed: Bug where checkUserDefinedCode called even if stage didn't exist

This commit is contained in:
Philip Love committed 2021-05-21 21:52:32 -04:00
1 parent 2ef6136989
commit 5edc510c2c
1 file changed
+2 -1
@@ -1255,7 +1255,8 @@ exports.newSuperalgosBotModulesTradingStages = function (processIndex) {
function checkUserDefinedCode(stage, status, when) {
let tradingSystemStage = getTradingSystemStage(stage);
if (tradingSystemStage.userDefinedCode !== undefined) {
if (tradingSystemStage !== undefined &&
tradingSystemStage.userDefinedCode !== undefined) {
if (status === 'Running' && when !== tradingSystemStage.userDefinedCode.config.whileAtStageWhenToRun) { return; }
switch(status) {