当我在调试模式下运行我的应用程序时,有时我会在此函数中遇到运行时错误:
void ChatListHandler::seatOccupancyChanged( const std::string& userName, bool occupied, bool isSelf, bool isSelfTable, int tableNo, int seatNo, int numPlayersAtTable )
{
if(!isSelf && (isInGroup(userName,IN_GAME_GROUP) || isInGroup(userName,IN_LOBBY_GROUP)))
{
if(occupied)
{
movePlayer(userName,IN_GAME_GROUP);
}
else
{
movePlayer(userName,IN_LOBBY_GROUP);
}
}
}
bool ChatListHandler::isInGroup( const std::string& name, GroupTypeEnum group )
{
for(size_t i = 0; i < m_groups.size(); ++i)
{
if(m_groups[i].second == group)
{
if(m_groups[i].first->getList())
{
for(agui::ListItem::iterator it =
m_groups[i].first->getList()->getItemsBegin(); it !=
m_groups[i].first->getList()->getItemsEnd(); ++it)
{
if((*it).first.text == name)
{
return true;
}
}
}
break;
}
}
return false;
m_list->repositionGroups();
}
它崩溃:
if((*it).first.text == name)
我得到:
Unhandled exception at 0x5fd1942c (msvcp90d.dll) in my.exe: 0xC0000005: Access violation reading location 0x00000040.
调用堆栈如下所示:
谢谢