From e56b8b2444ca9ae06c09da215d95802bb5ad9fcc Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sat, 28 Jun 2014 10:46:45 +0100 Subject: [PATCH] Fix SEGV when old charts.xml present .. because there will be ZERO presets ! --- src/LTMTool.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/LTMTool.cpp b/src/LTMTool.cpp index e5312082b..ec7a0a603 100644 --- a/src/LTMTool.cpp +++ b/src/LTMTool.cpp @@ -1113,7 +1113,10 @@ LTMTool::presetsChanged() add->setFlags(add->flags() | Qt::ItemIsEditable); add->setText(0, chart.name); } - charts->setCurrentItem(charts->invisibleRootItem()->child(0)); + + // select the first one, if there are any + if (context->athlete->presets.count()) + charts->setCurrentItem(charts->invisibleRootItem()->child(0)); } void