From 99e048a6c67150b15f8dfe45c2937e2f9b3b5f5f Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 11 Jan 2017 00:25:48 +1100 Subject: [PATCH] Prevent errors when no players in team --- includes/class-sp-event.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php index 46c6f8eb..ede124e1 100644 --- a/includes/class-sp-event.php +++ b/includes/class-sp-event.php @@ -175,6 +175,8 @@ class SP_Event extends SP_Custom_Post{ // Calculate equation-based performance if ( sizeof( $equations ) ): foreach ( $performance as $team => $players ): + if ( ! is_array( $players ) ) continue; + foreach ( $players as $player => $player_performance ): // Prepare existing values for equation calculation $vars = $player_performance; @@ -193,6 +195,8 @@ class SP_Event extends SP_Custom_Post{ // Convert to time notation if ( in_array( 'time', $formats ) ): foreach ( $performance as $team => $players ): + if ( ! is_array( $players ) ) continue; + foreach ( $players as $player => $player_performance ): if ( ! $player ) continue;