Prevent errors when no players in team

This commit is contained in:
Brian Miyaji
2017-01-11 00:25:48 +11:00
parent b20c35b633
commit 99e048a6c6

View File

@@ -175,6 +175,8 @@ class SP_Event extends SP_Custom_Post{
// Calculate equation-based performance // Calculate equation-based performance
if ( sizeof( $equations ) ): if ( sizeof( $equations ) ):
foreach ( $performance as $team => $players ): foreach ( $performance as $team => $players ):
if ( ! is_array( $players ) ) continue;
foreach ( $players as $player => $player_performance ): foreach ( $players as $player => $player_performance ):
// Prepare existing values for equation calculation // Prepare existing values for equation calculation
$vars = $player_performance; $vars = $player_performance;
@@ -193,6 +195,8 @@ class SP_Event extends SP_Custom_Post{
// Convert to time notation // Convert to time notation
if ( in_array( 'time', $formats ) ): if ( in_array( 'time', $formats ) ):
foreach ( $performance as $team => $players ): foreach ( $performance as $team => $players ):
if ( ! is_array( $players ) ) continue;
foreach ( $players as $player => $player_performance ): foreach ( $players as $player => $player_performance ):
if ( ! $player ) continue; if ( ! $player ) continue;