Added some safety checks to thingy file parser

This commit is contained in:
WerWolv 2021-02-14 12:32:48 +01:00
parent 714b62049c
commit 5286a2d9ae
1 changed files with 3 additions and 0 deletions

View File

@ -45,10 +45,13 @@ namespace hex {
hex::trim(from); hex::trim(from);
hex::trim(to); hex::trim(to);
if (from.empty()) continue;
if (to.empty()) to = " "; if (to.empty()) to = " ";
} }
auto fromBytes = hex::parseByteString(from); auto fromBytes = hex::parseByteString(from);
if (fromBytes.empty()) continue;
if (!this->m_mapping.contains(fromBytes.size())) if (!this->m_mapping.contains(fromBytes.size()))
this->m_mapping.insert({ fromBytes.size(), { } }); this->m_mapping.insert({ fromBytes.size(), { } });
this->m_mapping[fromBytes.size()].insert({ fromBytes, to }); this->m_mapping[fromBytes.size()].insert({ fromBytes, to });