From 769214fe5c242de635e24200b10cb9e890156e4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Sun, 21 Aug 2022 08:59:53 +0200 Subject: [PATCH] Watch for potential empty proxy model --- YACReaderLibrary/comic_vine/select_volume.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/YACReaderLibrary/comic_vine/select_volume.cpp b/YACReaderLibrary/comic_vine/select_volume.cpp index 76915488..d62e38eb 100644 --- a/YACReaderLibrary/comic_vine/select_volume.cpp +++ b/YACReaderLibrary/comic_vine/select_volume.cpp @@ -130,13 +130,19 @@ SelectVolume::~SelectVolume() { } void SelectVolume::loadVolumeInfo(const QModelIndex &omi) { + QString msgStyle = "%1"; + QModelIndex mi = proxyModel->mapToSource(omi); + if (!mi.isValid()) { + cover->clear(); + detailLabel->setAltText(msgStyle.arg(tr("Nothing found, clear the filter if any."))); + return; + } QString coverURL = model->getCoverURL(mi); QString id = model->getVolumeId(mi); - QString loadingStyle = "%1"; - cover->setText(loadingStyle.arg(tr("loading cover"))); - detailLabel->setAltText(loadingStyle.arg(tr("loading description"))); + cover->setText(msgStyle.arg(tr("loading cover"))); + detailLabel->setAltText(msgStyle.arg(tr("loading description"))); auto comicVineClient = new ComicVineClient; connect(comicVineClient, &ComicVineClient::seriesCover, this, &SelectVolume::setCover);