kopia lustrzana https://github.com/f4exb/sdrangel
Fix crash if some columns in .csv file is missing
rodzic
1b392ee53c
commit
3b0512bd29
|
@ -19,6 +19,7 @@
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "gui/dialpopup.h"
|
#include "gui/dialpopup.h"
|
||||||
#include "util/db.h"
|
#include "util/db.h"
|
||||||
|
@ -772,15 +773,22 @@ void SpectrumMarkersDialog::on_aMarkersImport_clicked()
|
||||||
|
|
||||||
while (CSV::readRow(in, &cols))
|
while (CSV::readRow(in, &cols))
|
||||||
{
|
{
|
||||||
m_annotationMarkers.push_back(SpectrumAnnotationMarker());
|
if (cols.size() >= 7)
|
||||||
m_annotationMarkers.back().m_startFrequency = cols[startCol].toLongLong();
|
{
|
||||||
m_annotationMarkers.back().m_bandwidth = cols[widthCol].toUInt();
|
m_annotationMarkers.push_back(SpectrumAnnotationMarker());
|
||||||
m_annotationMarkers.back().m_text = cols[textCol];
|
m_annotationMarkers.back().m_startFrequency = cols[startCol].toLongLong();
|
||||||
m_annotationMarkers.back().m_show = (SpectrumAnnotationMarker::ShowState) cols[showCol].toInt();
|
m_annotationMarkers.back().m_bandwidth = cols[widthCol].toUInt();
|
||||||
int r = cols[redCol].toInt();
|
m_annotationMarkers.back().m_text = cols[textCol];
|
||||||
int g = cols[greenCol].toInt();
|
m_annotationMarkers.back().m_show = (SpectrumAnnotationMarker::ShowState) cols[showCol].toInt();
|
||||||
int b = cols[blueCol].toInt();
|
int r = cols[redCol].toInt();
|
||||||
m_annotationMarkers.back().m_markerColor = QColor(r, g, b);
|
int g = cols[greenCol].toInt();
|
||||||
|
int b = cols[blueCol].toInt();
|
||||||
|
m_annotationMarkers.back().m_markerColor = QColor(r, g, b);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "SpectrumMarkersDialog::on_aMarkersImport_clicked: Missing data in " << cols;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_annotationMarkerIndex = 0;
|
m_annotationMarkerIndex = 0;
|
||||||
|
|
Ładowanie…
Reference in New Issue