Solved problem with QASSERT_X
-
hello,
I have a problem when I run my project on DEBUG mode.It ocurred the next error:
C:\Users\ENRIQUE\build-TFGVF-Desktop_Qt_5_6_1_MSVC2015_64bit-Debug\debug\TFGVF.exe exited with code 3ASSERT failure in QList<T>::at: "index out of range", file C:\Qt\Qt5.6.1\5.6\msvc2015_64\include\QtCore/qlist.h, line 531
template <typename T> inline const T &QList<T>::at(int i) const { Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>::at", "index out of range"); return reinterpret_cast<Node *>(p.at(i))->t(); }
I don't found the error in my project code, I think that the error is in this function:
void MainWindow::listo_leer_serie(){ info_arduino+=arduino_serie->readLine(); //qDebug()<<info_arduino; if(info_arduino.contains("fin")){ if(info_arduino.contains(",,,,,,,,,,")){ info_arduino.replace(",,,,,,,,,,",",,,,,,,,,"); } info_arduino.remove("fin"); info_arduino=info_arduino.trimmed(); QStringList lista_datos; lista_datos= info_arduino.split(",", QString::SkipEmptyParts); if(lista_datos.at(0)=="Datos"){ if(lista_datos.size() == 12){ qDebug()<<tr("Tenemos 12"); QString help; for(int i=1; i<=7; i++){ help=lista_datos.at(i); statesArduino[i] = help[0].toLatin1(); //qDebug()<<tr("Dato:%1").arg(QString::fromLatin1(statesArduino[i])); } help=lista_datos.at(8); powerR=help.toDouble(); qDebug()<<tr("Potencia R:%1").arg(QString::number(powerR)); help=lista_datos.at(9); powerS=help.toDouble(); qDebug()<<tr("Potencia S:%1").arg(QString::number(powerS)); help=lista_datos.at(10); powerT=help.toDouble(); qDebug()<<tr("Potencia T:%1").arg(QString::number(powerT)); help=lista_datos.at(11); irradiacionArduino = help.toDouble(); qDebug()<<tr("Irradicion:%1").arg(QString::number(irradiacionArduino)); } } // if(info_arduino.contains("Todo")){ // dato1=info_arduino; // } // if(info_arduino.contains("va")){ // dato2=info_arduino; // } // if(info_arduino.contains("bien")){ // dato3=info_arduino; // } //mensaje=dato1+"-"+dato2+"-"+dato3+"/n"; mensaje=dato1; info_arduino=""; //qDebug()<<tr("Lectura de datos realizada"); } //ui->listWidget->addItem(dato1); //ui->listWidget->addItem(dato2); //ui->listWidget->addItem(dato3); //screenView(); //screenLoads(); }
what coluld it be? I think that function is well but the erroralways ocurred when the code was running.
thanks a lot
I don't have much experience.
I am sorry, my English is not good -
before
if(lista_datos.at(0)=="Datos")
add a check forlista_datos
being empty -
I don't understand you.
do you refere that?:
if(!lista_datos.at(0)->isEmpty()){ if(lista_datos.at(0) =="Datos") .....
thnaks!
-
@riken7
Hi i think more likeif(!lista_datos.isEmpty()){ if(lista_datos.at(0) =="Datos") .....
as you will CRASH if you say at(0) and there is nothing in list.
-
thanks everybody!!!
I belive that problem is solved