Skip to content

Commit 0b9dc20

Browse files
Copilotaddison74
andcommitted
Use instanceof for more robust type checking in null checks
Co-authored-by: addison74 <[email protected]>
1 parent fd595b0 commit 0b9dc20

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/code/core/Mage/ConfigurableSwatches/Helper/Mediafallback.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function attachProductChildrenAttributeMapping(array $parentProducts, $st
5454
$swatchAttributeIds = Mage::helper('configurableswatches')->getSwatchAttributeIds();
5555
}
5656

57-
if ($listSwatchAttr && $listSwatchAttr->getId()) {
57+
if ($listSwatchAttr instanceof Mage_Eav_Model_Entity_Attribute_Abstract && $listSwatchAttr->getId()) {
5858
$swatchAttributeIds[] = $listSwatchAttr->getId();
5959
}
6060

@@ -127,7 +127,7 @@ public function attachProductChildrenAttributeMapping(array $parentProducts, $st
127127
$mapping[$optionLabel]['default_label'] = $optionLabels[$optionId][0];
128128
$mapping[$optionLabel]['labels'] = $optionLabels[$optionId];
129129

130-
if ($listSwatchAttr
130+
if ($listSwatchAttr instanceof Mage_Eav_Model_Entity_Attribute_Abstract
131131
&& $attribute->getAttributeId() == $listSwatchAttr->getAttributeId()
132132
&& !in_array($mapping[$optionLabel]['label'], $listSwatchValues)
133133
) {

0 commit comments

Comments
 (0)