<commit_before>import { Directive } from '@angular/core';

import { Sidebar } from './sidebar.component';

@Directive({
  selector: '[closeSidebar]',
  host: {
    '(click)': '_onClick()'
  }
})
export class CloseSidebar {
  constructor(private _sidebar: Sidebar) {}

  /** @internal */
  _onClick(): void {
    this._sidebar.close();
  }
}
<commit_msg>Null check for directive in case not used in a sidebar<commit_after>import { Directive } from '@angular/core';

import { Sidebar } from './sidebar.component';

@Directive({
  selector: '[closeSidebar]',
  host: {
    '(click)': '_onClick()'
  }
})
export class CloseSidebar {
  constructor(private _sidebar: Sidebar) {}

  /** @internal */
  _onClick(): void {
    if (this._sidebar) {
      this._sidebar.close();
    }
  }
}

{'fraction_non_alphanumeric': 0.17051282051282052, 'fraction_numerical': 0.0, 'mean_word_length': 3.6488095238095237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5153982', 'n_tokens_mistral': 261, 'n_tokens_neox': 254, 'n_words': 60}