From e4e58f036b2db4e2d57e6425db7b663e0e32ac4a Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 1 Apr 2023 19:59:47 +0200 Subject: [PATCH] Added an error dialog to GuiThemeDownloader for when the themes.json file can't be parsed Also added error handling for missing image files in the themes.json file --- es-app/src/guis/GuiThemeDownloader.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/es-app/src/guis/GuiThemeDownloader.cpp b/es-app/src/guis/GuiThemeDownloader.cpp index fce8b4293..24d0cd3c3 100644 --- a/es-app/src/guis/GuiThemeDownloader.cpp +++ b/es-app/src/guis/GuiThemeDownloader.cpp @@ -491,7 +491,14 @@ void GuiThemeDownloader::parseThemesList() doc.Parse(reinterpret_cast(themesFileData.ptr.get()), themesFileData.length); if (doc.HasParseError()) { - LOG(LogWarning) << "GuiThemeDownloader: Couldn't parse the themes.json file"; + LOG(LogError) << "GuiThemeDownloader: Couldn't parse the themes.json file"; + mWindow->pushGui(new GuiMsgBox( + getHelpStyle(), + "COULDN'T PARSE THE THEMES LIST CONFIGURATION FILE, MAYBE THE LOCAL REPOSITORY IS " + "CORRUPT?", + "OK", [] { return; }, "", nullptr, "", nullptr, true)); + mGrid.removeEntry(mCenterGrid); + mGrid.setCursorTo(mButtons); return; } @@ -723,6 +730,8 @@ void GuiThemeDownloader::updateInfoPane() if (!mThemeSets[mList->getCursorId()].screenshots.empty()) mScreenshot->setImage(mThemeDirectory + "themes-list/" + mThemeSets[mList->getCursorId()].screenshots.front().image); + else + mScreenshot->setImage(""); if (mThemeSets[mList->getCursorId()].isCloned) { mDownloadStatus->setText(ViewController::TICKMARK_CHAR + " INSTALLED"); @@ -803,6 +812,9 @@ void GuiThemeDownloader::setupFullscreenViewer() mViewerScreenshots.front()->getSize().x + (mViewerIndicatorRight->getSize().x * 3.0f); mViewerIndicatorRight->setPosition(indicatorPos); } + else { + mFullscreenViewing = false; + } } void GuiThemeDownloader::update(int deltaTime)