make sure rproc isn't trashed in AGWMsg.pm
[spider.git] / perl / AGWMsg.pm
index c167d994a883eb7d0433495b512d03582679060d..90f469d82afe107d174bbaefcb904a115c6a495a 100644 (file)
@@ -51,8 +51,11 @@ $connectinterval = 60;
 sub init
 {
        return unless $enable;
-       $rproc = shift;
        
+       # only set $rproc if there is something to set rproc from!
+       my $rp = shift;
+       $rproc = $rp if defined $rp;
+
        finish();
 
        dbg("AGW initialising and connecting to $addr/$port ...");
@@ -125,6 +128,8 @@ sub _sendf
        my $pid  = shift || 0;
        my $data = shift || '';
        my $len  = 0;
+
+       return unless $sock;
        
        $len = length $data; 
        if ($sort eq 'y' || $sort eq 'H') {