From 84c77ae394dfba1ee400976e934abafb38d2b898 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Mon, 6 Dec 2004 08:51:23 +0000 Subject: More runtime safety -- don't crash against corrupted rpmdbs. --- rpmdrake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rpmdrake b/rpmdrake index d2113ff2..bcd6bb22 100755 --- a/rpmdrake +++ b/rpmdrake @@ -228,8 +228,16 @@ sub myformatList { } sub split_fullname { $_[0] =~ /^(.*)-([^-]+-[^-]+)$/ } -sub my_fullname { my ($name, $version, $release) = $_[0]->fullname; "$name-$version-$release" } -sub urpm_name { my ($name, $version, $release, $arch) = $_[0]->fullname; "$name-$version-$release.$arch" } +sub my_fullname { + return '?-?-?' unless ref $_[0]; + my ($name, $version, $release) = $_[0]->fullname; + "$name-$version-$release"; +} +sub urpm_name { + return '?-?-?.?' unless ref $_[0]; + my ($name, $version, $release, $arch) = $_[0]->fullname; + "$name-$version-$release.$arch"; +} sub parse_compssUsers_flat { my (%compssUsers, $category); -- cgit v1.2.1