Skip to content

Commit ab146d9

Browse files
committed
Fix Preferences apply silently discarding changes when a page fails to instantiate
Guard obj before calling apply() in PreferencesDialog to prevent a TypeError on undefined from corrupting the ok accumulator. Also null-safe parent binding in PreferencesPage to avoid the root cause during instantiation. Fixes: #33841
1 parent d402227 commit ab146d9

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/preferences/qml/MuseScore/Preferences/PreferencesDialog.qml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ StyledDialogView {
182182
for (var i in pages) {
183183
var page = pages[i]
184184
var obj = root.prv.pagesObjects[page.id]
185-
ok &= obj.apply()
185+
if (obj) {
186+
ok &= obj.apply()
187+
}
186188
}
187189

188190
if (ok) {

src/preferences/qml/MuseScore/Preferences/PreferencesPage.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import Muse.UiComponents
2727

2828
Rectangle {
2929
id: root
30-
height: parent.height
30+
height: parent ? parent.height : 0
3131
color: ui.theme.backgroundSecondaryColor
3232

3333
default property alias contentData: content.data

0 commit comments

Comments
 (0)