]> Sergey Matveev's repositories - public-inbox.git/commitdiff
inbox: avoid trying s// on undef
authorEric Wong <e@80x24.org>
Sun, 26 Jun 2016 23:41:00 +0000 (23:41 +0000)
committerEric Wong <e@80x24.org>
Sun, 26 Jun 2016 23:41:00 +0000 (23:41 +0000)
Oops, I guess I'm trigger-happy today.

Fixes: 31a6ff1221fe ("inbox: ensure we do not show leading "From " lines")
lib/PublicInbox/Inbox.pm

index 87c2c9fcdb57c14a50f625192b36a344abdc8ffe..ada713c741657ef16522d4b118cffebcbd95c4be 100644 (file)
@@ -100,7 +100,7 @@ sub msg_by_path ($$;$) {
        my ($self, $path, $ref) = @_;
        # TODO: allow other refs:
        my $str = git($self)->cat_file('HEAD:'.$path, $ref);
-       $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
+       $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s if $str;
        $str;
 }