我最近一直在研究一個項目。當我嘗試運行該項目時,出現此錯誤:QList中的ASSERT失敗<T> :: operator []:「索引超出範圍」文件/usr/include/arm-linux-gnueabihf/qt5/QtCore/qlist.h
/ASSERT failure in QList<T>::operator[]: "index out of range", file /usr/include/arm-linux-gnueabihf/qt5/QtCore/qlist.h, line 487
The program has unexpectedly finished.
我該如何去追蹤問題的根源?
我相信,當這個x = xy[2];
y = xy[3];
取出加入這個代碼導致錯誤
startvaluexy = Client::straightxy;
qDebug() << "start value Received from server :" << startvaluexy;
QStringList xy = startvaluexy.split("|");
x = xy[2];
QString num1 = x;
int x = num1.toInt();
qDebug() << "start x value :" << x;
y = xy[3];
QString num2 = y;
int y = num2.toInt();
qDebug() << "start y value :" << y;
,然後運行良好。
嘗試在純shell中執行此操作,並檢查它是否具有相同的行爲。代碼會像'export 13>/sys/class/gpio/export; echo low>/sysclass/gpio/gpio13/direction; for $ in(seq 1000);做echo 1>/sys/class/gpio/gpio13/value;睡1; echo 0>/sys/class/gpio/gpio13/value;完成' – 0andriy