| @@ -117,10 +117,16 @@ | ||
| 117 | 117 | * @SuppressWarnings(PHPMD.NPathComplexity) |
| 118 | 118 | * @param array $conditions Conditions data. |
| 119 | 119 | */ |
| 120 | 120 | function sellkit_conditions_validation( $conditions ) { |
| 121 | - $is_valid = true; | |
| 122 | - $condition_type = ! empty( $conditions[1]['type'] ) ? $conditions[1]['type'] : 'and'; | |
| 121 | + $is_valid = true; | |
| 122 | + | |
| 123 | + if ( empty( $conditions ) ) { | |
| 124 | + return true; | |
| 125 | + } | |
| 126 | + | |
| 127 | + $first_condition = reset( $conditions ); | |
| 128 | + $condition_type = ! empty( $first_condition['type'] ) ? $first_condition['type'] : 'and'; | |
| 123 | 129 | |
| 124 | 130 | if ( 'or' === $condition_type ) { |
| 125 | 131 | $is_valid = false; |
| 126 | 132 | } |