diff options
author | Ermal <eri@pfsense.org> | 2010-04-27 11:08:57 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-04-27 11:08:57 +0000 |
commit | b7729cee83698e320032c1b58627f4cda97c9b85 (patch) | |
tree | ed91b3254ed03e6f21424f2c2195d82a06877a2c | |
parent | db3829e199abc61a089a80c2c668b7370a6c9fac (diff) | |
download | pfsense-b7729cee83698e320032c1b58627f4cda97c9b85.zip pfsense-b7729cee83698e320032c1b58627f4cda97c9b85.tar.gz |
Do not error out when trying to delete an unexisting package. Just display an error message.
-rw-r--r-- | etc/inc/pkg-utils.inc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index a443c28..03fd780 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -276,11 +276,13 @@ function get_pkg_depends($pkg_name, $filetype = ".xml", $format = "files", $retu function uninstall_package_from_name($pkg_name) { global $config; $id = get_pkg_id($pkg_name); - $pkg_depends =& $config['installedpackages']['package'][$id]['depends_on_package']; - delete_package($pkg_depends[0], $pkg_name); - if (is_array($pkg_depends)) { - foreach ($pkg_depends as $pkg_depend) - remove_freebsd_package($pkg_depend); + if ($id >= 0) + $pkg_depends =& $config['installedpackages']['package'][$id]['depends_on_package']; + delete_package($pkg_depends[0], $pkg_name); + if (is_array($pkg_depends)) { + foreach ($pkg_depends as $pkg_depend) + remove_freebsd_package($pkg_depend); + } } delete_package_xml($pkg_name); } |