added var check to prevent warnings on the numerous timed_read(0) calls
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 30 Aug 2006 15:23:24 +0000 (15:23 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Wed, 30 Aug 2006 15:23:24 +0000 (15:23 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@772 9efc2488-bf62-4759-914b-345cdb29e865

src/perlmods/OpenSRF/Transport/SlimJabber/Client.pm

index d67e77d..77daf79 100644 (file)
@@ -566,19 +566,21 @@ sub process {
        }
 
        my $t = $self->{last_tag};
-       my @msgs = $val =~ /(<$t[^>]*>.*?<\/$t>)/g;
-       $val = shift(@msgs);
 
-       if (@msgs) {
-               my $tmp = $self->{temp_buffer};
-
-               $self->{temp_buffer} = '';
-               $self->{temp_buffer} .= $_ for (@msgs);
-               $self->{temp_buffer} .= $tmp;
+       if( $t and $val ) {
+               my @msgs = $val =~ /(<$t[^>]*>.*?<\/$t>)/g;
+               $val = shift(@msgs);
+       
+               if (@msgs) {
+                       my $tmp = $self->{temp_buffer};
+       
+                       $self->{temp_buffer} = '';
+                       $self->{temp_buffer} .= $_ for (@msgs);
+                       $self->{temp_buffer} .= $tmp;
+               }
        }
 
        return $val;
-
 }