Skip to content

Commit

Permalink
Return a sane list of defaults if the selected highlighters are empty
Browse files Browse the repository at this point in the history
In previous versions it was possible that the selection got lost, eventually breaking the implementation.
  • Loading branch information
dtdesign committed Nov 14, 2024
1 parent 1bc7e47 commit befc650
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion wcfsetup/install/files/lib/system/bbcode/BBCodeHandler.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,30 @@ public function getHighlighters()
*/
public function getCodeBlockLanguages(): array
{
return \explode("\n", StringUtil::unifyNewlines(\MESSAGE_PUBLIC_HIGHLIGHTERS));
$highlighters = \explode("\n", StringUtil::unifyNewlines(\MESSAGE_PUBLIC_HIGHLIGHTERS));
if ($highlighters !== []) {
return $highlighters;
}

return [
'c',
'cpp',
'csharp',
'css',
'go',
'html',
'java',
'javascript',
'json',
'php',
'python',
'ruby',
'rust',
'sql',
'typescript',
'xml',
'yaml',
];
}

/**
Expand Down

0 comments on commit befc650

Please sign in to comment.