1
Fork 0
mirror of https://github.com/redstrate/Astra.git synced 2025-04-23 04:57:44 +00:00

News: Handle no banner images case a bit better

This stops it from spamming the logs with nonsense
This commit is contained in:
Joshua Goins 2023-10-08 13:25:45 -04:00
parent 3b0c445c3d
commit 943cd61990

View file

@ -33,10 +33,14 @@ QQC2.Control {
running: true
repeat: true
onTriggered: {
if (page.numBannerImages === 0) {
return;
}
if (page.currentBannerIndex + 1 === page.numBannerImages) {
page.currentBannerIndex = 0
page.currentBannerIndex = 0;
} else {
page.currentBannerIndex++
page.currentBannerIndex++;
}
}
}
@ -56,7 +60,17 @@ QQC2.Control {
Layout.preferredHeight: aspectRatio * width
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
source: LauncherCore.headline !== null ? LauncherCore.headline.banners[page.currentBannerIndex].bannerImage : ""
source: {
if (LauncherCore.headline === null) {
return "";
}
if (page.numBannerImages === 0) {
return "";
}
return LauncherCore.headline.banners[page.currentBannerIndex].bannerImage;
}
MouseArea {
anchors.fill: parent