check if data can be split

This commit is contained in:
w-mj
2018-11-04 15:40:24 +08:00
parent 7bd74e53c6
commit 8d30f7a09f
+2
View File
@@ -92,8 +92,10 @@ void SerialController::handleRecv()
try { try {
qDebug()<<str; qDebug()<<str;
QStringList sl = str.split("|"); QStringList sl = str.split("|");
if (sl.size() == 2) {
a = sl[0].toInt(); a = sl[0].toInt();
d = sl[1].toInt(); d = sl[1].toInt();
}
qDebug()<<a<<","<<d; qDebug()<<a<<","<<d;
emit sendPos(a, d); emit sendPos(a, d);
} catch(...) { } catch(...) {