From cbc404e74035bc778c0ae81a8bcb31274b2827f7 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Fri, 1 Dec 2017 21:29:26 +0100 Subject: [PATCH] fix: warning with 0 heroes #341 --- Templates/Build/37.tpl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Templates/Build/37.tpl b/Templates/Build/37.tpl index c7abd466..45654d3a 100644 --- a/Templates/Build/37.tpl +++ b/Templates/Build/37.tpl @@ -67,14 +67,16 @@ } else { $include_training = true; $include_revive = false; - foreach ($heroes as $hdata) { - if ($hdata['dead'] == 1) { - $include_revive = true; - } + if (isset($heroes) && is_array($heroes) && count($heroes)) { + foreach ( $heroes as $hdata ) { + if ( $hdata['dead'] == 1 ) { + $include_revive = true; + } - if ($hdata['inrevive'] == 1) { - $name1 = $hdata['name']; - $include_training = false; + if ( $hdata['inrevive'] == 1 ) { + $name1 = $hdata['name']; + $include_training = false; + } } }