Skip to content

Commit acead1e

Browse files
committed
MAGETWO-56947: [API] Can not link simple product to configurable one - mainline
1 parent cf81282 commit acead1e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/code/Magento/Catalog/Model/Product.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,10 +1909,12 @@ public function addOption(Product\Option $option)
19091909
*/
19101910
public function getOptionById($optionId)
19111911
{
1912-
/** @var \Magento\Catalog\Model\Product\Option $option */
1913-
foreach ($this->getOptions() as $option) {
1914-
if ($option->getId() == $optionId) {
1915-
return $option;
1912+
if (is_array($this->getOptions())) {
1913+
/** @var \Magento\Catalog\Model\Product\Option $option */
1914+
foreach ($this->getOptions() as $option) {
1915+
if ($option->getId() == $optionId) {
1916+
return $option;
1917+
}
19161918
}
19171919
}
19181920

0 commit comments

Comments
 (0)