Repository: microsoft/terminal
File: src/cascadia/TerminalSettingsEditor/SettingContainer.cpp (C++)

Code before:
                    const auto headerText{ header.try_as<hstring>() };
                    if (headerText && !headerText->empty())
                    {
                        Automation::AutomationProperties::SetName(obj, *headerText);
                    }
                }

                // apply help text as tooltip and full description (automation property)
                const auto& helpText{ HelpText() };
                if (!helpText.empty())
                {
                    Controls::ToolTipService::SetToolTip(obj, box_value(helpText));
                    Automation::AutomationProperties::SetFullDescription(obj, helpText);
                }
            }
        }

        if (const auto& child{ GetTemplateChild(L"Expander") })
        {
            if (const auto& expander{ child.try_as<Microsoft::UI::Xaml::Controls::Expander>() })
            {
                // apply header text as name (automation property)
                if (const auto& header{ Header() })
                {
                    const auto headerText{ header.try_as<hstring>() };
                    if (headerText && !headerText->empty())
                    {
                        Automation::AutomationProperties::SetName(expander, *headerText);
                    }
                }

                // apply help text as tooltip and full description (automation property)
                const auto& helpText{ HelpText() };
                if (!helpText.empty())
                {
                    Controls::ToolTipService::SetToolTip(expander, box_value(helpText));
                    Automation::AutomationProperties::SetFullDescription(expander, helpText);
                }
            }
        }

        if (HelpText().empty())
        {
            if (const auto& child{ GetTemplateChild(L"HelpTextBlock") })
            {
                if (const auto& textBlock{ child.try_as<Controls::TextBlock>() })
                {
                    textBlock.Visibility(Visibility::Collapsed);
                }
            }
        }

Review comment (suggestion):
I believe an empty hstring is the same as a null hstring, so you can just put this all in one condition?

```cpp
if (const auto headerText{ header.try_as<hstring>() })
```

(same applies below!)

Code after:
            }
        }
        else if (const auto& content{ Content() })
        {
            if (const auto& obj{ content.try_as<DependencyObject>() })
            {
                base = obj;
            }
        }

        if (base)
        {
            // apply header as name (automation property)
            if (const auto& header{ Header() })
            {
                if (const auto headerText{ header.try_as<hstring>() })
                {
                    Automation::AutomationProperties::SetName(base, *headerText);
                }
            }

            // apply help text as tooltip and full description (automation property)
            if (const auto& helpText{ HelpText() }; !helpText.empty())
            {
                Controls::ToolTipService::SetToolTip(base, box_value(helpText));
                Automation::AutomationProperties::SetFullDescription(base, helpText);
            }
        }

        if (HelpText().empty())
        {
            if (const auto& child{ GetTemplateChild(L"HelpTextBlock") })
            {
                if (const auto& textBlock{ child.try_as<Controls::TextBlock>() })
                {
                    textBlock.Visibility(Visibility::Collapsed);
                }
            }
        }
    }

    // Method Description:
    // - Updates the override system visibility and text
    // Arguments:
    // - <none>
    void SettingContainer::_UpdateOverrideSystem()
    {
        if (const auto& child{ GetTemplateChild(L"ResetButton") })
        {
            if (const auto& button{ child.try_as<Controls::Button>() })
            {