diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-04-06 16:10:06 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-04-06 16:10:06 +0000 |
commit | c2eb36d9cf93163593edbaa53454e26cc546f081 (patch) | |
tree | 8197c49fef9024b591887a77141a54a2657fe636 /etc | |
parent | 9f71ee2f13bf4ac1d70604edf668b2e513322dc8 (diff) | |
download | pfsense-c2eb36d9cf93163593edbaa53454e26cc546f081.zip pfsense-c2eb36d9cf93163593edbaa53454e26cc546f081.tar.gz |
Do not foreach through installedpackages if no installed packages exist.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index 38b6b03..05df632 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -370,10 +370,11 @@ function get_pkg_id($pkg_name) { global $config; global $pkg_config; $i=0; - foreach ($config['installedpackages']['package'] as $pkg) { - if($pkg['name'] == $pkg_name) return $i; - $i++; - } + if(is_array($config['installedpackages']['package'])) + foreach ($config['installedpackages']['package'] as $pkg) { + if($pkg['name'] == $pkg_name) return $i; + $i++; + } return -1; } |