backporting some defensive method param checks
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Nov 2007 16:07:29 +0000 (16:07 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 21 Nov 2007 16:07:29 +0000 (16:07 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@8108 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm

index 831dc4e..c5af420 100644 (file)
@@ -1,4 +1,5 @@
 package OpenILS::Application::AppUtils;
+# vim:noet:ts=4
 use strict; use warnings;
 use OpenILS::Application;
 use base qw/OpenILS::Application/;
@@ -754,6 +755,13 @@ sub fetch_stat_cat_entry {
 
 sub find_org {
        my( $self, $org_tree, $orgid )  = @_;
+       if (!$org_tree) {
+               $logger->warn("find_org() did not receive a value for \$org_tree");
+               return undef;
+       } elsif (!$orgid) {
+               $logger->warn("find_org() did not receive a value for \$orgid");
+               return undef;
+    }
        return $org_tree if ( $org_tree->id eq $orgid );
        return undef unless ref($org_tree->children);
        for my $c (@{$org_tree->children}) {