Prevent error when results are empty
This commit is contained in:
@@ -541,18 +541,19 @@ class SP_Player_List extends SP_Secondary_Post {
|
||||
if ( sizeof( $results ) ):
|
||||
foreach ( $results as $id => $team_results ):
|
||||
if ( $team_id == $id ) continue;
|
||||
$team_results['outcome'] = null;
|
||||
unset( $team_results['outcome'] );
|
||||
foreach ( $team_results as $result_slug => $team_result ):
|
||||
if ( is_array( $team_results ) ):
|
||||
unset( $team_results['outcome'] );
|
||||
foreach ( $team_results as $result_slug => $team_result ):
|
||||
|
||||
// Add to total
|
||||
$value = sp_array_value( $totals[ $player_id ], $result_slug . 'against', 0 );
|
||||
$value += floatval( $team_result );
|
||||
$totals[ $player_id ][ $result_slug . 'against' ] = $value;
|
||||
// Add to total
|
||||
$value = sp_array_value( $totals[ $player_id ], $result_slug . 'against', 0 );
|
||||
$value += floatval( $team_result );
|
||||
$totals[ $player_id ][ $result_slug . 'against' ] = $value;
|
||||
|
||||
// Add subset
|
||||
$totals[ $player_id ][ $result_slug . 'against' . ( $i + 1 ) ] = $team_result;
|
||||
endforeach;
|
||||
// Add subset
|
||||
$totals[ $player_id ][ $result_slug . 'against' . ( $i + 1 ) ] = $team_result;
|
||||
endforeach;
|
||||
endif;
|
||||
endforeach;
|
||||
endif;
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user