From: simon Date: Wed, 23 Nov 2011 19:56:00 +0000 (+0000) Subject: Handle parse failures more sensibly. X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/utils/commitdiff_plain/1a88a03e1fd012bde266c95fa326730e7f057e47 Handle parse failures more sensibly. git-svn-id: svn://svn.tartarus.org/sgt/utils@9342 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/nntpid/nntpid b/nntpid/nntpid index ffdde0d..015b277 100755 --- a/nntpid/nntpid +++ b/nntpid/nntpid @@ -137,8 +137,10 @@ if ($mode eq 'all') { $fatal = 0; # ignore failure to retrieve any given article for ($mid = $numbers[1]; $mid <= $numbers[2]; $mid++) { $art = &getart("$group:$mid"); - $art =~ s/\n(>*From )/\n>$1/gs; - print "From nntpid ".(localtime)."\n".$art."\n"; + if (defined $art) { + $art =~ s/\n(>*From )/\n>$1/gs; + print "From nntpid ".(localtime)."\n".$art."\n"; + } } } elsif ($mode eq 'stdin') { while (<>) { @@ -178,6 +180,7 @@ sub displayarticle { &connect; my $art = &getart($mid); + return unless defined $art; if ($pager and -t STDOUT) { # Close the NNTP connection before invoking the pager, in case the