fix: safeguard against undefined ServerSettings during db migration

This commit is contained in:
Tiberiu Ichim 2026-02-22 17:20:36 +02:00
parent c8a34ad60e
commit b0280f614b

View file

@ -171,7 +171,7 @@ module.exports.cleanStringForSearch = (str) => {
const getTitleParts = (title) => {
if (!title) return ['', null]
const prefixesToIgnore = global.ServerSettings.sortingPrefixes || []
const prefixesToIgnore = global.ServerSettings?.sortingPrefixes || []
for (const prefix of prefixesToIgnore) {
// e.g. for prefix "the". If title is "The Book" return "Book, The"
if (title.toLowerCase().startsWith(`${prefix} `)) {