diff --git a/src/ReferenceListFormatter.php b/src/ReferenceListFormatter.php index 8f92d3d72..bf93c57aa 100644 --- a/src/ReferenceListFormatter.php +++ b/src/ReferenceListFormatter.php @@ -101,7 +101,7 @@ class ReferenceListFormatter { // Make sure the parent is not a subreference. // FIXME: Move to a validation function. $extends =& $ref->extends; - if ( $extends !== null && isset( $groupRefs[$extends]->extends ) ) { + if ( $extends !== null && isset( $groupRefs[$extends] ) && $groupRefs[$extends]->extends !== null ) { $ref->warnings[] = [ 'cite_error_ref_nested_extends', $extends, $groupRefs[$extends]->extends ]; } diff --git a/src/Validator.php b/src/Validator.php index 9764b99a0..868568765 100644 --- a/src/Validator.php +++ b/src/Validator.php @@ -66,7 +66,7 @@ class Validator { if ( isset( $groupRefs[$name] ) && $groupRefs[$name]->extends === null ) { // T242141: A top-level can't be changed into a sub-reference return StatusValue::newFatal( 'cite_error_references_duplicate_key', $name ); - } elseif ( isset( $groupRefs[$extends]->extends ) ) { + } elseif ( isset( $groupRefs[$extends] ) && $groupRefs[$extends]->extends !== null ) { // A sub-reference can not be extended a second time (no nesting) return StatusValue::newFatal( 'cite_error_ref_nested_extends', $extends, $groupRefs[$extends]->extends );