Fixes for ILS::make_header.
authorJason Stephenson <jason@sigio.com>
Thu, 7 Aug 2014 13:01:55 +0000 (09:01 -0400)
committerJason Stephenson <jason@sigio.com>
Thu, 7 Aug 2014 13:01:55 +0000 (09:01 -0400)
Signed-off-by: Jason Stephenson <jason@sigio.com>
lib/NCIP/ILS.pm

index aae5939..6d5f06a 100644 (file)
@@ -86,7 +86,8 @@ sub make_header {
     my $header;
 
     for my $key (keys %$request) {
-        if ($request->{$key}->{InitiationHeader}) {
+        if (ref $request->{$key} eq 'HASH'
+                && $request->{$key}->{InitiationHeader}) {
             $initheader = $request->{$key}->{InitiationHeader};
             last;
         }
@@ -94,10 +95,10 @@ sub make_header {
 
     if ($initheader && $initheader->{FromAgencyId}
             && $initheader->{ToAgencyId}) {
-        $header = NCIP::Header->new(
+        $header = NCIP::Header->new({
             FromAgencyId => $initheader->{ToAgencyId},
             ToAgencyId => $initheader->{FromAgencyId}
-        );
+        });
     }
 
     return $header;