Would it be a fix to change the code for each exit in that function from:
Code: Select all
if( {exit number edit box on exit dialogue}->text().size() > 0 )
mpHost->mpMap->rooms[mRoomID]->{exit} = {exit number edit box on exit dialogue}->text().toInt();
else
mpHost->mpMap->rooms[mRoomID]->{exit} = -1;
Code: Select all
if( {exit number edit box on exit dialogue}->text().size() > 0 )
{
if( mpHost->mpMap->rooms.contains( {exit number edit box on exit dialogue}->text().toInt() ) )
mpHost->mpMap->rooms[mRoomID]->{exit} = {exit number edit box on exit dialogue}->text().toInt();
else
mpHost->mpMap->rooms[mRoomID]->{exit} = -1;
}
else
mpHost->mpMap->rooms[mRoomID]->{exit} = -1;
I would point out that this type of situation is most likely to occur from a typo when entering in an Exit number, resulting say in a repeated digit taking the resulting value outside of the range of existing rooms so it is not a totally unlikely event to happen and the consequences are significant enough, I feel, to require attention.