summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgitweb/gitweb.perl3
1 files changed, 3 insertions, 0 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1c54301582..588b87d234 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1740,6 +1740,9 @@ sub esc_html_hl_regions {
for my $s (@sel) {
my ($begin, $end) = @$s;
+ # Don't create empty <span> elements.
+ next if $end <= $begin;
+
my $escaped = esc_html(substr($str, $begin, $end - $begin));
$out .= esc_html(substr($str, $pos, $begin - $pos))