ASSERT failure in QList<T>::at: "index out of range"
-
Again, did you check that the value of current is lower than the size of the string list ?
-
@Qjay But is it changed somewhere?
Why not just check like this?qDebug() << v.toStringList().size() << current; qDebug() << v.toStringList().at(current); QUrl url = v.toStringList().at(current);
In such a situation this is actually the first thing to do...
-
hey @jsulm
i tried what you suggested
qDebug() << v.toStringList().size() << current; qDebug() << v.toStringList().at(current); QUrl url = v.toStringList().at(current);
i did this
qDebug() << "stringlist size and current" << v.toStringList().size() << current; qDebug() << "current url in stringlist" << v.toStringList().at(current); QUrl url = v.toStringList().at(current); qDebug() << "why break" << url;
output
stringlist size and current 33 0 current url in stringlist "(http://restbase.wikitolearn.org/en.wikitolearn.org/v1/media/math/render/svg/3cd95482da53d42c5f7f249454f7ee1e85cacc0c)" why break QUrl("") ""
and then error
ASSERT failure in QList<T>::at: "index out of range", file ../../Qt5.7.0/5.7/gcc_64/include/QtCore/qlist.h, line 537 The program has unexpectedly finished.
-
Looks like you are doing a lot of parsing, replacement etc.
The first thing I'd do, is to just ensure that you really have URLs in your list. And get rid of that QVariant parameter. It really doesn't make any sense in your use case.
-
Hello , thanks for the suggetions .
-
yes there were useless ( ) in url . i have removed them . Now i am able to assign url to Qurl :D great!!
-
i removed the Qvariant thing too
now the code is
.cpp : https://ghostbin.com/paste/vv2w7
header file : https://ghostbin.com/paste/8z4y3
but the assert error still exist :/
-
-
Still at the same place ?
-
From the looks of it, you're currently lucky.
I'd recommend considering refactoring and cleaning up this code. Maybe a full rewrite would even be better.