elements.php: Fail gracefully if script configs can't be loaded

Signed-off-by: Tobias K <6317548+thecalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias K 2023-01-27 15:48:44 +01:00 committed by Tobias Knöppler
parent 0827781a5a
commit bab86f2687
No known key found for this signature in database
GPG Key ID: 3510056072886A8F

View File

@ -182,6 +182,13 @@ function print_sidebar( $l /* translations l10n object */, $ticks /* wether to c
$cfg_file = $cfg_dir . $ncp_app . ".cfg";
$cfg = json_decode(file_get_contents($cfg_file), true);
try {
sizeof($cfg['params']);
} catch (TypeError $e) {
error_log("Failed loading script '$script'!, Config file '$cfg_file' could not be found or failed to be parsed.\n");
continue;
}
$active = "";
if ( $ticks ) {
exec("bash -c \"source /usr/local/etc/library.sh && is_active_app $ncp_app\"", $output, $retval);