]> git.mjollnir.org Git - cil.git/commitdiff
protection if there are no hooks registered yet
authorYanick Champoux <yanick@babyl.dyndns.org>
Thu, 24 Jul 2008 17:04:54 +0000 (13:04 -0400)
committerAndrew Chilton <andy@chilts.com>
Thu, 31 Jul 2008 08:42:33 +0000 (10:42 +0200)
lib/CIL.pm

index 42451a26f8933f9c799d2f6bfcd1e4e849fc8b95..c433810f75be5d19056556f841d7574ab7f77a5b 100644 (file)
@@ -310,8 +310,10 @@ sub run_hook {
     }
 
     # call all the hooks with all the args
-    foreach my $code ( @{$self->hook->{$hook_name}} ) {
-        &$code( $self, @rest );
+    if ( ref $self->hook eq 'HASH' ) {
+        foreach my $code ( @{$self->hook->{$hook_name}} ) {
+            &$code( $self, @rest );
+        }
     }
 }