Skip to content

Commit

Permalink
Merge pull request #11504 from nanaya/str-replace-null
Browse files Browse the repository at this point in the history
Fix null being passed to str replace
  • Loading branch information
notbakaneko authored Sep 24, 2024
2 parents 9f27725 + d24e913 commit 9d30f8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/Libraries/Markdown/Osu/DocumentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ private function loadToc()
}

$title = presence($this->getText($this->node));
$slug = $this->node->data['attributes']['id'] ?? presence(mb_strtolower(str_replace(' ', '-', $title))) ?? 'page';
$slug = $this->node->data['attributes']['id']
?? presence(mb_strtolower(strtr($title ?? '', ' ', '-')))
?? 'page';

if (array_key_exists($slug, $this->tocSlugs)) {
$this->tocSlugs[$slug] += 1;
Expand Down

0 comments on commit 9d30f8e

Please sign in to comment.