skip reading when firmware-product doesn't exist, avoids issues when running stand-alone for https://github.com/opnsense/ui_devtools/issues/3

This commit is contained in:
Ad Schellevis 2018-09-03 21:21:15 +02:00
parent b6b3a5ad1d
commit 18dcbcbd72

View File

@ -187,9 +187,11 @@ class ControllerBase extends ControllerRoot
$this->view->ui_theme = $cnf->object()->theme;
}
$product_vars = json_decode(file_get_contents(__DIR__.'/../../../../../firmware-product'), true);
foreach ($product_vars as $product_key => $product_var) {
$this->view->$product_key = $product_var;
if (is_file(__DIR__.'/../../../../../firmware-product')) {
$product_vars = json_decode(file_get_contents(__DIR__.'/../../../../../firmware-product'), true);
foreach ($product_vars as $product_key => $product_var) {
$this->view->$product_key = $product_var;
}
}
// info about the current user and box