Skip to content

Commit 7bbdac3

Browse files
committed
guard premature model access
mention in #28 also don't brick strings together
1 parent 97460ce commit 7bbdac3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Phototonic.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -3169,12 +3169,12 @@ void Phototonic::reloadThumbs() {
31693169
void Phototonic::setImageViewerWindowTitle() {
31703170
QStandardItemModel *thumbModel = static_cast<QStandardItemModel*>(thumbsViewer->model());
31713171
const int currentRow = thumbsViewer->currentIndex().row();
3172+
if (currentRow < 0) { // model is still loading, yay threads
3173+
setWindowTitle(QFileInfo(imageViewer->fullImagePath).fileName());
3174+
return;
3175+
}
31723176
QString title = thumbModel->item(currentRow)->data(Qt::DisplayRole).toString()
3173-
+ " - ["
3174-
+ QString::number(currentRow + 1)
3175-
+ "/"
3176-
+ QString::number(thumbModel->rowCount())
3177-
+ "] - Phototonic";
3177+
+ QString::fromLatin1(" - [ %1 / %2 ] - Phototonic").arg(currentRow + 1).arg(thumbModel->rowCount());
31783178

31793179
setWindowTitle(title);
31803180
}

0 commit comments

Comments
 (0)