Skip to content

Commit 2269a19

Browse files
fix: null dereference in get_SelectionContainer when no selection container exists (#16091)
* fix: null dereference in get_SelectionContainer when no container found Agent-Logs-Url: https://github.com/microsoft/react-native-windows/sessions/dee66731-6253-459a-8ba1-f733d5bee554 Co-authored-by: vineethkuttan <66076509+vineethkuttan@users.noreply.github.com> * Change files --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: vineethkuttan <66076509+vineethkuttan@users.noreply.github.com>
1 parent b5297b9 commit 2269a19

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "fix: null dereference in get_SelectionContainer when no container found",
4+
"packageName": "react-native-windows",
5+
"email": "66076509+vineethkuttan@users.noreply.github.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,11 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_SelectionContainer(I
10641064
*pRetVal = nullptr;
10651065

10661066
auto selectionContainerView = GetSelectionContainer();
1067+
// Per UIA spec, returning S_OK with *pRetVal == nullptr is correct when the element
1068+
// is not contained within a selection container.
1069+
if (!selectionContainerView)
1070+
return S_OK;
1071+
10671072
auto uiaProvider =
10681073
winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(selectionContainerView)
10691074
->EnsureUiaProvider();

0 commit comments

Comments
 (0)