Don't set currentIndex to -1 while reinitializing

It causes warnings in other code that have property bindings to currentIndex
This commit is contained in:
Cameron Gutman 2023-09-12 19:28:33 -05:00
parent b7301d4415
commit c6a8f44640

View file

@ -593,19 +593,20 @@ Flickable {
} }
var saved_fps = StreamingPreferences.fps var saved_fps = StreamingPreferences.fps
currentIndex = -1 var found = false
for (var i = 0; i < model.count; i++) { for (var i = 0; i < model.count; i++) {
var el_fps = parseInt(model.get(i).video_fps); var el_fps = parseInt(model.get(i).video_fps);
// Look for a matching frame rate // Look for a matching frame rate
if (saved_fps === el_fps) { if (saved_fps === el_fps) {
currentIndex = i currentIndex = i
found = true
break break
} }
} }
// If we didn't find one, add a custom frame rate for the current value // If we didn't find one, add a custom frame rate for the current value
if (currentIndex === -1) { if (!found) {
currentIndex = addRefreshRateOrdered(model, saved_fps, qsTr("Custom (%1 FPS)").arg(saved_fps), true) currentIndex = addRefreshRateOrdered(model, saved_fps, qsTr("Custom (%1 FPS)").arg(saved_fps), true)
} }
else { else {