From 5fdf0bdff47271866b5e87cc570b917793e76e83 Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Mon, 12 Nov 2018 04:10:57 +0000 Subject: [PATCH] Fix debug assert in CabrilloLogModel on reset of model with no rows --- models/CabrilloLog.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/models/CabrilloLog.cpp b/models/CabrilloLog.cpp index 7eb820fee..1efc7743e 100644 --- a/models/CabrilloLog.cpp +++ b/models/CabrilloLog.cpp @@ -54,8 +54,8 @@ CabrilloLog::impl::impl (Configuration const * configuration) setEditStrategy (QSqlTableModel::OnManualSubmit); setTable ("cabrillo_log"); - setHeaderData (fieldIndex ("frequency"), Qt::Horizontal, tr ("Frequency")); - setHeaderData (fieldIndex ("when"), Qt::Horizontal, tr ("Date and Time")); + setHeaderData (fieldIndex ("frequency"), Qt::Horizontal, tr ("Freq(kHz)")); + setHeaderData (fieldIndex ("when"), Qt::Horizontal, tr ("Date & Time(UTC)")); setHeaderData (fieldIndex ("call"), Qt::Horizontal, tr ("Call")); setHeaderData (fieldIndex ("exchange_sent"), Qt::Horizontal, tr ("Sent")); setHeaderData (fieldIndex ("exchange_rcvd"), Qt::Horizontal, tr ("Rcvd")); @@ -104,9 +104,12 @@ bool CabrilloLog::dupe (Frequency frequency, QString const& call) const void CabrilloLog::reset () { - ConditionalTransaction transaction {*m_}; - SQL_error_check (*m_, &QSqlTableModel::removeRows, 0, m_->rowCount (), QModelIndex {}); - transaction.submit (); + if (m_->rowCount ()) + { + ConditionalTransaction transaction {*m_}; + SQL_error_check (*m_, &QSqlTableModel::removeRows, 0, m_->rowCount (), QModelIndex {}); + transaction.submit (); + } } void CabrilloLog::export_qsos (QTextStream& stream) const