Issue #19: Fix "Trying to access array offset on value of type null" (#23)

This commit is contained in:
Universal Omega 2021-03-23 17:47:30 -06:00 committed by GitHub
parent a93d831018
commit fbd18eac88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -850,13 +850,16 @@ class Parameters extends ParametersData {
*/ */
public function _titlematch( $option ) { public function _titlematch( $option ) {
$data = $this->getParameter( 'title' ); $data = $this->getParameter( 'title' );
if ( !is_array( $data['like'] ) ) {
if ( !isset( $data['like'] ) || !is_array( $data['like'] ) ) {
$data['like'] = []; $data['like'] = [];
} }
$newMatches = explode( '|', str_replace( ' ', '\_', $option ) ); $newMatches = explode( '|', str_replace( ' ', '\_', $option ) );
$data['like'] = array_merge( $data['like'], $newMatches ); $data['like'] = array_merge( $data['like'], $newMatches );
$this->setParameter( 'title', $data ); $this->setParameter( 'title', $data );
$this->setSelectionCriteriaFound( true ); $this->setSelectionCriteriaFound( true );
return true; return true;
} }