aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/template/context.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/template/context.php')
-rw-r--r--phpBB/phpbb/template/context.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index 2ba6d185ad..202e29ce00 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -201,7 +201,8 @@ class context
$pos = strpos($blocks[$i], '[');
$name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i];
$block = &$block[$name];
- $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block) - 1));
+ $block_count = empty($block) ? 0 : count($block) - 1;
+ $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? $block_count : (min((int) substr($blocks[$i], $pos + 1, -1), $block_count));
$block = &$block[$index];
}