summaryrefslogtreecommitdiffstats
path: root/src/dialog.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2017-11-17 18:35:59 +0100
committerSimon Rettberg2017-11-17 18:35:59 +0100
commiteaa61ab0197a9f28c5099e2e5e2e48efa70fce0f (patch)
tree96948022ccdbe4fb7613108ed1ea896691ee8e2d /src/dialog.cpp
parentFix uninitialized variable (diff)
downloadvmchooser2-eaa61ab0197a9f28c5099e2e5e2e48efa70fce0f.tar.gz
vmchooser2-eaa61ab0197a9f28c5099e2e5e2e48efa70fce0f.tar.xz
vmchooser2-eaa61ab0197a9f28c5099e2e5e2e48efa70fce0f.zip
Try to fix segfault when selecting last session (needs verification)
Diffstat (limited to 'src/dialog.cpp')
-rw-r--r--src/dialog.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dialog.cpp b/src/dialog.cpp
index 0de9e93..c07a71d 100644
--- a/src/dialog.cpp
+++ b/src/dialog.cpp
@@ -255,12 +255,14 @@ bool Dialog::selectSession(const QString& name) {
for (int i = 0; i < model_[tab]->rowCount(root); ++i) {
QModelIndex section(model_[tab]->index(i, 0, root));
if (!section.isValid()) {
- break;
+ continue;
}
for (int j = 0; j < model_[tab]->rowCount(section); ++j) {
QModelIndex index(model_[tab]->index(j, 0, section));
+ if (!index.isValid())
+ continue;
SessionTreeItem* item = static_cast<SessionTreeItem*>(index.internalPointer());
- const Session* s(item->session());
+ const Session* s = item->session();
if (s == NULL) {
continue;
}