diff options
| author | Christoph Berg <christoph.berg@credativ.de> | 2019-03-11 14:19:23 +0100 |
|---|---|---|
| committer | Christoph Berg <christoph.berg@credativ.de> | 2019-03-11 14:19:23 +0100 |
| commit | 200de07a95209a55d6019ba87f0abc78d302bf4c (patch) | |
| tree | 3b2922eb5d89b01ad214cae492e871c3bfb5df18 /logbook | |
| parent | e0737c56c1e384e05064a0c6e1ac46979371041b (diff) | |
New upstream version 2.0.1+repackupstream/2.0.1+repack
Diffstat (limited to 'logbook')
| -rw-r--r-- | logbook/WorkedBefore.cpp | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/logbook/WorkedBefore.cpp b/logbook/WorkedBefore.cpp index 160e1fa8..daaf18fc 100644 --- a/logbook/WorkedBefore.cpp +++ b/logbook/WorkedBefore.cpp @@ -320,30 +320,27 @@ namespace } } while ((end_position = buffer.indexOf ("<EOR>", 0, Qt::CaseInsensitive)) < 0 && !in.atEnd ()); - if (end_position < 0) - { - throw LoaderException (std::runtime_error {"Invalid ADIF record starting at: " + buffer.left (40).toStdString ()}); - } - auto record = buffer.left (end_position + 5).trimmed (); - auto next_record = buffer.indexOf (QChar {'<'}, end_position + 5); - buffer.remove (0, next_record >=0 ? next_record : buffer.size ()); - record = record.mid (record.indexOf (QChar {'<'})); - auto call = extractField (record, "CALL"); - if (call.size ()) - { - auto const& entity = prefixes->lookup (call); - worked.emplace (call.toUpper () - , extractField (record, "GRIDSQUARE").left (4).toUpper () // not interested in 6-digit grids - , extractField (record, "BAND").toUpper () - , extractField (record, "MODE").toUpper () - , entity.entity_name - , entity.continent - , entity.CQ_zone - , entity.ITU_zone); - } - else + if (end_position >= 0) // require valid ADIF record + // with terminator { - throw LoaderException (std::runtime_error {"Invalid ADIF record with no CALL: " + record.toStdString ()}); + auto record = buffer.left (end_position + 5).trimmed (); + auto next_record = buffer.indexOf (QChar {'<'}, end_position + 5); + buffer.remove (0, next_record >=0 ? next_record : buffer.size ()); + record = record.mid (record.indexOf (QChar {'<'})); + auto call = extractField (record, "CALL"); + if (call.size ()) // require CALL field before we + // will parse a record + { + auto const& entity = prefixes->lookup (call); + worked.emplace (call.toUpper () + , extractField (record, "GRIDSQUARE").left (4).toUpper () // not interested in 6-digit grids + , extractField (record, "BAND").toUpper () + , extractField (record, "MODE").toUpper () + , entity.entity_name + , entity.continent + , entity.CQ_zone + , entity.ITU_zone); + } } } } |
