<commit_before>﻿namespace Fluent.Automation.Peers
{
    using System.Collections.Generic;
    using System.Windows.Automation;
    using System.Windows.Automation.Peers;
    using System.Windows.Automation.Provider;
    using JetBrains.Annotations;

    /// <summary>
    /// Automation peer for <see cref="Backstage"/>.
    /// </summary>
    public class RibbonBackstageAutomationPeer : RibbonControlAutomationPeer, IExpandCollapseProvider
    {
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        public RibbonBackstageAutomationPeer([NotNull] Backstage owner)
            : base(owner)
        {
            this.OwningBackstage = owner;
        }

        private Backstage OwningBackstage { get; }

        /// <inheritdoc />
        protected override AutomationControlType GetAutomationControlTypeCore()
        {
            return AutomationControlType.Menu;
        }

        /// <inheritdoc />
        public override object GetPattern(PatternInterface patternInterface)
        {
            switch (patternInterface)
            {
                case PatternInterface.ExpandCollapse:
                    return this;
            }

            return base.GetPattern(patternInterface);
        }

        /// <inheritdoc />
        protected override List<AutomationPeer> GetChildrenCore()
        {
            var children = new List<AutomationPeer>();

            var automationPeer = CreatePeerForElement(this.OwningBackstage.Content);

            if (automationPeer != null)
            {
                children.Add(automationPeer);<commit_msg>Fixing possible NullRef exception in automation peer<commit_after>﻿namespace Fluent.Automation.Peers
{
    using System.Collections.Generic;
    using System.Windows.Automation;
    using System.Windows.Automation.Peers;
    using System.Windows.Automation.Provider;
    using JetBrains.Annotations;

    /// <summary>
    /// Automation peer for <see cref="Backstage"/>.
    /// </summary>
    public class RibbonBackstageAutomationPeer : RibbonControlAutomationPeer, IExpandCollapseProvider
    {
        /// <summary>
        /// Creates a new instance.
        /// </summary>
        public RibbonBackstageAutomationPeer([NotNull] Backstage owner)
            : base(owner)
        {
            this.OwningBackstage = owner;
        }

        private Backstage OwningBackstage { get; }

        /// <inheritdoc />
        protected override AutomationControlType GetAutomationControlTypeCore()
        {
            return AutomationControlType.Menu;
        }

        /// <inheritdoc />
        public override object GetPattern(PatternInterface patternInterface)
        {
            switch (patternInterface)
            {
                case PatternInterface.ExpandCollapse:
                    return this;
            }

            return base.GetPattern(patternInterface);
        }

        /// <inheritdoc />
        protected override List<AutomationPeer> GetChildrenCore()
        {
            var children = new List<AutomationPeer>();

            if (this.OwningBackstage.Content != null)
            {
                var automationPeer = CreatePeerForElement(this.OwningBackstage.Content);

                if (automationPeer != null)
                {
                    children.Add(automationPeer);
                }
{'fraction_non_alphanumeric': 0.08708619147032508, 'fraction_numerical': 0.0, 'mean_word_length': 1.9139878366637706, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2891288', 'n_tokens_mistral': 837, 'n_tokens_neox': 797, 'n_words': 164}