microsoft / react-native-windows

A framework for building native Windows apps with React.
https://microsoft.github.io/react-native-windows/
Other
16.33k stars 1.14k forks source link

Result of call that may return NULL dereferenced unconditionally error #10564

Closed jonthysell closed 2 years ago

jonthysell commented 2 years ago

Problem Description

CodeQL reports 5 Result of call that may return NULL dereferenced unconditionally errors in the NativeUIManager.cpp file.

Steps To Reproduce

Link to the CodeQL (corpnet-only): https://onees.lgtm.microsoft.com/projects/u/gh/microsoft%2Freact-native-windows%2Ftree%2Fmain/alerts/?mode=tree&ruleFocus=1000894

Expected Results

No response

CLI version

npx react-native --version

Environment

npx react-native info

Target Platform Version

No response

Target Device(s)

No response

Visual Studio Version

No response

Build Configuration

No response

Snack, code example, screenshot, or link to a repository

↑ | 1-814 -- | -- 815 | YGNodeRef yogaOldParent = GetYogaNode(oldParentTag); 816 | if (yogaOldParent != nullptr) { 817 | YGNodeRemoveChild(yogaOldParent, yogaNodeToAdd);   | In AddView result of call to GetYogaNode is dereferenced here and may be null. 818 | } 819 |   820 | YGNodeInsertChild(yogaNodeToManage, yogaNodeToAdd, static_cast(index));   | In AddView result of call to GetYogaNode is dereferenced here and may be null.In AddView result of call to GetYogaNode is dereferenced here and may be null. 821 | } 822 | } ↓↑ | 823-832 833 | for (uint32_t i = childCount; i > 0; --i) { 834 | YGNodeRef yogaNodeToRemove = YGNodeGetChild(yogaNode, i - 1); 835 | YGNodeRemoveChild(yogaNode, yogaNodeToRemove);   | In RemoveView result of call to YGNodeGetChild is dereferenced here and may be null. 836 | } 837 | } ↓↑ | 838-871 872 | if (pViewManager->RequiresYogaNode()) { 873 | YGNodeRef yogaNode = GetYogaNode(node.m_tag); 874 | StyleYogaNode(node, yogaNode, props);   | In UpdateView result of call to GetYogaNode is dereferenced here and may be null. 875 | } 876 | } ↓ | 877-1162
jonthysell commented 2 years ago

This alert no longer appears in CodeQL, moving to Backlog.