[QList::operator[]: "index out of range"]
-
Hello,
I hope you're all doing well.
I was wondering if in my code, I have used multiple lists and when running the app, I get the error of " index out of range".. How can I know exactly which list is causing the problem.
Running in debug mode, stops at this line: (qlist.h)
Q_ASSERT_X(size_t(i) < size_t(d->size), "QList::operator[]", "index out of range"); detach();
But doesn't tell in which list the problem occured.
Please help.
Thank you all.
-
Use the debugger and put a breakpoint there.
-
@Chris-Kawa Thank youuuuu so much.
-
@appdev said in [QList::operator[]: "index out of range"]:
But doesn't tell in which list the problem occured.
Yes it stops at that line. But look for the stack view pane, it's one of the debugger windows. In that you will see the call stack starting from there (
qlist.h
) but leading back up frames to your code. That tells you where in your code it was ultimately called from.