Skip to content

Commit 1e2bcad

Browse files
MC-37653: New/Edit Dynamic Block with Different User Role
1 parent ff00d17 commit 1e2bcad

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

app/code/Magento/PageBuilder/Model/Stage/Preview.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,16 @@ public function startPreviewMode($callback, $storeId = null)
9595
$this->isPreview = true;
9696

9797
if (!$storeId) {
98-
$storeId = $this->storeManager->getDefaultStoreView()->getId();
98+
$store = $this->storeManager->getDefaultStoreView();
99+
if ($store) {
100+
$storeId = $store->getId();
101+
} else {
102+
$stores = $this->storeManager->getStores();
103+
if (count($stores)) {
104+
$store = array_shift($stores);
105+
$storeId = $store->getId();
106+
}
107+
}
99108
}
100109
$this->emulation->startEnvironmentEmulation($storeId);
101110

0 commit comments

Comments
 (0)