The following commit has been merged in the master branch:
commit d1ad567b436f441f13b8007becc7c00d36b9113c
Author: Niels Thykier <[email protected]>
Date:   Wed Jan 5 14:52:34 2011 +0100

    Fail if the type is not known since other parts do not check the
    return value (leads to "weird undefined values" in checks).

diff --git a/lib/Lintian/Collect.pm b/lib/Lintian/Collect.pm
index e916086..809b4ab 100644
--- a/lib/Lintian/Collect.pm
+++ b/lib/Lintian/Collect.pm
@@ -18,10 +18,11 @@
 
 package Lintian::Collect;
 use strict;
+use Util qw(fail);
 
 # Take the package name and type, initialize an appropriate collect object
-# based on the package type, and return it.  Returns undef for an unknown
-# package type.
+# based on the package type, and return it.  fail with unknown types,
+# since we do not check in other packes if this returns a value.
 sub new {
     my ($class, $pkg, $type) = @_;
     my $object;
@@ -35,7 +36,7 @@ sub new {
        require Lintian::Collect::Changes;
        $object = Lintian::Collect::Changes->new ($pkg);
     } else {
-        return;
+        fail("Undefined type: $type");
     }
     $object->{name} = $pkg;
     $object->{type} = $type;

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to