RMG: account for filenames without a dot in RomBrowserWidget::getCurrentCover()

This commit is contained in:
Rosalie Wanders committed 2023-02-02 21:21:59 +01:00
1 parent 9afd971b43
commit a6cba2ce2a
1 file changed
+4 -1
@@ -362,7 +362,10 @@ QIcon RomBrowserWidget::getCurrentCover(QString file, CoreRomHeader header, Core
// until the end of the string
QString baseName = QFileInfo(file).fileName();
qsizetype lastIndexOfDot = baseName.lastIndexOf(".");
baseName.remove(lastIndexOfDot, baseName.size() - lastIndexOfDot);
if (lastIndexOfDot != -1)
{ // only remove when index was found
baseName.remove(lastIndexOfDot, baseName.size() - lastIndexOfDot);
}
// try to load cover using
// 1) basename of file