Handle parse failures more sensibly.
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 23 Nov 2011 19:56:00 +0000 (19:56 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 23 Nov 2011 19:56:00 +0000 (19:56 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/utils@9342 cda61777-01e9-0310-a592-d414129be87e

nntpid/nntpid

index ffdde0d..015b277 100755 (executable)
@@ -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