diff --git a/src/bundle/Controller/ContentOnTheFlyController.php b/src/bundle/Controller/ContentOnTheFlyController.php
index <HASH>..<HASH> 100644
--- a/src/bundle/Controller/ContentOnTheFlyController.php
+++ b/src/bundle/Controller/ContentOnTheFlyController.php
@@ -295,14 +295,6 @@ class ContentOnTheFlyController extends Controller
                 ? $this->contentActionDispatcher
                 : $this->createContentActionDispatcher;
 
-            if (!$location instanceof Location) {
-                $contentInfo = $this->contentService->loadContentInfo($content->id);
-
-                if (!empty($contentInfo->mainLocationId)) {
-                    $location = $this->locationService->loadLocation($contentInfo->mainLocationId);
-                }
-            }
-
             $actionDispatcher->dispatchFormAction(
                 $form,
                 $form->getData(),
@@ -310,6 +302,14 @@ class ContentOnTheFlyController extends Controller
                 ['referrerLocation' => $location]
             );
 
+            if (!$location instanceof Location) {
+                $contentInfo = $this->contentService->loadContentInfo($content->id);
+
+                if (null !== $contentInfo->mainLocationId) {
+                    $location = $this->locationService->loadLocation($contentInfo->mainLocationId);
+                }
+            }
+
             if ($actionDispatcher->getResponse()) {
                 $view = new EditContentOnTheFlySuccessView('@ezdesign/ui/on_the_fly/content_edit_response.html.twig');
                 $view->addParameters([
EZP-<I>: Fixed CotF blank screen after publishing (#<I>)