|
-
July 4th, 2012, 10:14 AM
#1
First chance exception:crash
list<Pnt*>::iterator start =hex_cplist_combine->PntList_xy.begin();
list<Pnt *>::iterator end ;
for(start; start !=hex_cplist_combine->PntList_xy.end()
{
//FreePntArr();
g_ObjRecSetup.mappingsetup.CartStarter.x = (*start)->x;
g_ObjRecSetup.mappingsetup.CartStarter.y = (*start)->y;
end=hex_cplist_combine->PntList_xy.begin();
//for(end; end !=cart_cplist->PntList_xy.end()
for(end; end !=hex_cplist_combine->PntList_xy.end()
{
Curve * pPolarPath, * pCartPath;
pPolarPath = newCurve();
pCartPath = newCurve();
try
{
g_ObjRecSetup.mappingsetup.CartEnd.x= (*end)->x;
g_ObjRecSetup.mappingsetup.CartEnd.y = (*end)->y;
}
catch (exception& e)
{
AddReportData(0,"exception caught:%s",e.what());
}
display();
end++;
}
start++;
}
Above is the part of my code.I keep getting first chance exception at the line highlighted in bold.My code also crashes and I cant figure out why?The list does have values and nothing is null as far as I checked.
Thanks
Shweta
-
July 4th, 2012, 11:36 AM
#2
Re: First chance exception:crash
You can't dereference an end iterator: It points past the last item in the container. You can't increment an end iterator either, BTW.
Unlike the original in that ancient thread, this post doesn't have any line highlighted in bold, BTW. And please use code tags when posting code. The way it is now, your code is almost absolutely unreadable.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|