Browse Source

Fix potential bug where using !unset on a variable would result in a crash

master
Adam Pippin 3 years ago
parent
commit
b470283fde
  1. 8
      app/Engine/Cfnpp/Compiler.php

8
app/Engine/Cfnpp/Compiler.php

@ -202,7 +202,13 @@ class Compiler implements \App\Engine\ICompile
foreach ($variables_ordered as $variable)
{
$this->runFunctions($variables_raw[$variable]);
$options->setVariable($variable, Node::toPhp($variables_node->getChildByName($variable)));
$variable_node = $variables_node->getChildByName($variable);
// By all accounts this _should_ still exist, but this accounts for the
// case where, say, someone had used !unset on a variable for some reason.
if (isset($variable_node))
{
$options->setVariable($variable, Node::toPhp($variable_node));
}
}
}

Loading…
Cancel
Save