From 664a1a6e2ac8a90f3bf2ddf50a796138a3673bf2 Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 12 Oct 2015 20:51:08 +0200 Subject: Fix crash in PictureViewer2 Don't try to access an empty QList. It comes from the constructor. There has to be a better way to fix this, but right now it eludes me... --- pictureviewer2.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pictureviewer2.cpp') diff --git a/pictureviewer2.cpp b/pictureviewer2.cpp index 2eb4566..a722bbb 100644 --- a/pictureviewer2.cpp +++ b/pictureviewer2.cpp @@ -221,6 +221,11 @@ void PictureViewer2::skip(int amount){ void PictureViewer2::selectPic(const QString &path){ for(int i = 0; i < mFiles.size(); ++i){ + // This is the intial data from the constructor. + // Don't crash trying to access FullPath + if(mFiles.at(i).isEmpty()){ + continue; + } if(mFiles.at(i).at(PicFilesModel::FullPath) == path){ mCurPos = i; showFile(mFiles.at(mCurPos)); -- cgit v1.2.3-70-g09d2