From: Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Date: Sun, 3 Aug 2008 15:16:24 +0000 (+0100)
Subject: Suppress warning about uninitialized value if directives look like [[!foo]]
X-Git-Tag: 2.53.1~27
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=17da020690744c89c644d318cc31a19c9ab1fb4b;p=ikiwiki.git

Suppress warning about uninitialized value if directives look like [[!foo]]
(cherry picked from commit cf58eefaa56eb17c227d97d129bf95e3dab54fd3)
(cherry picked from commit 4c2f46e3fa34238bbdd093f0b3d211103a3b94a3)
---

diff --git a/IkiWiki.pm b/IkiWiki.pm
index 5a05a0f73..e0793b5fa 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -844,7 +844,8 @@ sub preprocess ($$$;$$) { #{{{
 		}sx;
 	}
 
-	$content =~ s{$regex}{$handle->($1, $2, $3, $4)}eg;
+	# $4 can be undef if the directive was [[!foo]]
+	$content =~ s{$regex}{$handle->($1, $2, $3, ($4 or ""))}eg;
 	return $content;
 } #}}}