Skip to content

Commit 8721f79

Browse files
authored
Update ReferenceHelper.php (#1873)
* Update ReferenceHelper for Defined Names
1 parent 0715b63 commit 8721f79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/PhpSpreadsheet/ReferenceHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ public function insertNewBefore($pBefore, $pNumCols, $pNumRows, Worksheet $pShee
608608
// Update workbook: define names
609609
if (count($pSheet->getParent()->getDefinedNames()) > 0) {
610610
foreach ($pSheet->getParent()->getDefinedNames() as $definedName) {
611-
if ($definedName->getWorksheet()->getHashCode() === $pSheet->getHashCode()) {
611+
if ($definedName->getWorksheet() !== null && $definedName->getWorksheet()->getHashCode() === $pSheet->getHashCode()) {
612612
$definedName->setValue($this->updateCellReference($definedName->getValue(), $pBefore, $pNumCols, $pNumRows));
613613
}
614614
}

0 commit comments

Comments
 (0)