Skip to content

Commit 5762253

Browse files
committed
Ensure previous focused instance exists before accessing it
Signed-off-by: Danilo Aimini <[email protected]>
1 parent 1a271cd commit 5762253

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/PrefabFocusHandler.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,10 @@ namespace AzToolsFramework::Prefab
288288
m_rootAliasFocusPathLength = aznumeric_cast<int>(AZStd::distance(m_rootAliasFocusPath.begin(), m_rootAliasFocusPath.end()));
289289

290290
// Unset the DOM caching for previous focus and enabled it in new focus to optimize editing.
291-
previousFocusedInstance->get().EnableDomCaching(false);
291+
if (previousFocusedInstance.has_value())
292+
{
293+
previousFocusedInstance->get().EnableDomCaching(false);
294+
}
292295
focusedInstance->get().EnableDomCaching(true);
293296

294297
// Focus on the container entity in the Editor, if the interface is initialized.

0 commit comments

Comments
 (0)