diff options
author | jim-p <jimp@pfsense.org> | 2014-08-08 12:22:53 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2014-08-08 12:24:29 -0400 |
commit | 762e8cf91f9a1be21de47d97f2310ffe808a2f5e (patch) | |
tree | b2f560ec6a7782bb430c9e878d3b8e4fbf2f73ee /etc | |
parent | b6513591da72694fd7b76db0b09c0b52ebddfd52 (diff) | |
download | pfsense-762e8cf91f9a1be21de47d97f2310ffe808a2f5e.zip pfsense-762e8cf91f9a1be21de47d97f2310ffe808a2f5e.tar.gz |
Avoid a "Cannot use string offset as an array" error if the packages section of the config is missing.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/service-utils.inc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 362af4d..600682f 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -187,10 +187,13 @@ function is_service_enabled($service_name) { global $config; if ($service_name == "") return false; - if (isset($config['installedpackages'][$service_name]['config'][0]['enable']) && - ((empty($config['installedpackages'][$service_name]['config'][0]['enable'])) || - ($config['installedpackages'][$service_name]['config'][0]['enable'] === 'off'))) - return false; + if (is_array($config['installedpackages'])) { + if (isset($config['installedpackages'][$service_name]['config'][0]['enable']) && + ((empty($config['installedpackages'][$service_name]['config'][0]['enable'])) || + ($config['installedpackages'][$service_name]['config'][0]['enable'] === 'off'))) { + return false; + } + } return true; } |