Try to prevent false directed decodes

This commit is contained in:
Jordan Sherer 2018-07-13 21:58:43 -04:00
parent 09b12701b5
commit 4de968d2f0

View File

@ -60,7 +60,12 @@ DecodedText::DecodedText (QString const& the_string, bool contest_mode, QString
} }
void DecodedText::tryUnpackDirected(){ void DecodedText::tryUnpackDirected(){
QStringList parts = Varicode::unpackDirectedMessage(message()); QString m = message().trimmed();
if(m.length() < 12 || m.contains(' ')){
return;
}
QStringList parts = Varicode::unpackDirectedMessage(m);
if(parts.isEmpty()){ if(parts.isEmpty()){
return; return;
@ -68,6 +73,7 @@ void DecodedText::tryUnpackDirected(){
// replace it with the correct unpacked // replace it with the correct unpacked
message_ = QString("%1:%2%3").arg(parts.at(0), parts.at(1), parts.at(2)); message_ = QString("%1:%2%3").arg(parts.at(0), parts.at(1), parts.at(2));
directed_ = parts; directed_ = parts;
} }