Skip to content

Commit f92ee24

Browse files
committed
MC-33699: Stabilize MFTF tests
1 parent d15f85a commit f92ee24

File tree

1 file changed

+8
-5
lines changed
  • app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options

1 file changed

+8
-5
lines changed

app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,16 @@ protected function reformatSwatchLabels($swatchStoreValue = null)
9494
}
9595
$newSwatch = [];
9696
foreach ($swatchStoreValue as $key => $value) {
97-
if ($value[0] == '#') {
98-
$newSwatch[$key] = 'background: '.$value;
99-
} elseif ($value[0] == '/') {
100-
$mediaUrl = $this->swatchHelper->getSwatchMediaUrl();
101-
$newSwatch[$key] = 'background: url('.$mediaUrl.$value.'); background-size: cover;';
97+
if (is_string($value) && !empty($value)) {
98+
if ($value[0] == '#') {
99+
$newSwatch[$key] = 'background: ' . $value;
100+
} elseif ($value[0] == '/') {
101+
$mediaUrl = $this->swatchHelper->getSwatchMediaUrl();
102+
$newSwatch[$key] = 'background: url(' . $mediaUrl . $value . '); background-size: cover;';
103+
}
102104
}
103105
}
106+
104107
return $newSwatch;
105108
}
106109
}

0 commit comments

Comments
 (0)