I have recently been working on a project. When I attempt to run the project I get this error:
/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.
How I might go about tracking down the source of the problem?
I believe that the addition of this code is causing the error
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;
When this x = xy[2];
y = xy[3];
is taken out, then runs fine.
This is working fine.
startvaluexy = EchoClient::straightxy;
qDebug() << "start xy value Received from server :" << startvaluexy;
QStringList xy = startvaluexy.split("|");
int xySize = xy.size();
qDebug() << "start xy size :" << xySize;
if(xySize < 4){
return false;
}
bool ok;
int x = xy[2].toInt(&ok);
if(!ok){
return false;
}
int y = xy[3].toInt(&ok);
if(!ok){
return false;
}
return true;