# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2016-04-03 15:18:19 # Node ID 921170ff88f1908998999f6230ecebb8db2153c4 # Parent 807cd6bb15726c30465a24ce8949756485e15ed9 fix crash when opening snapshot loaded from file, read channel names from the file diff --git a/src/snapshotmanager.cpp b/src/snapshotmanager.cpp --- a/src/snapshotmanager.cpp +++ b/src/snapshotmanager.cpp @@ -147,7 +147,8 @@ void SnapshotManager::loadSnapshotFromFi // read first row as headlines and determine number of channels auto headLine = QString(file.readLine()); - unsigned numOfChannels = headLine.split(',').size(); + QStringList channelNames = headLine.split(','); + unsigned numOfChannels = channelNames.size(); // read data QVector> data(numOfChannels); @@ -185,6 +186,7 @@ void SnapshotManager::loadSnapshotFromFi auto snapshot = new Snapshot(_mainWindow, QFileInfo(fileName).baseName()); snapshot->data = data; + snapshot->setChannelNames(channelNames); addSnapshot(snapshot, false); }