From: Steve Brokenshire Date: Tue, 9 Feb 2016 23:51:30 +0000 (+0000) Subject: Fixed potential crash with frmContactEditorIM in Edit mode. X-Git-Tag: release-0.09~28 X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=commitdiff_plain;h=c612fb7241f0e7b8736745da18af62458e2c2e32 Fixed potential crash with frmContactEditorIM in Edit mode. This would be caused because no checks were made on the iterator to see if it was valid or not. --- diff --git a/source/contacteditor/frmContactEditorIM.cpp b/source/contacteditor/frmContactEditorIM.cpp index 40bfef1..9d22d94 100644 --- a/source/contacteditor/frmContactEditorIM.cpp +++ b/source/contacteditor/frmContactEditorIM.cpp @@ -300,8 +300,17 @@ void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType) } - strIMUser = IMListPtr->find(IMListIndex)->second; - strIMType = IMListTypeInfoPtr->find(IMListIndex)->second; + if (IMListPtr->find(IMListIndex) != IMListPtr->end()){ + + strIMUser = IMListPtr->find(IMListIndex)->second; + + } + + if (IMListTypeInfoPtr->find(IMListIndex) != IMListTypeInfoPtr->end()){ + + strIMType = IMListTypeInfoPtr->find(IMListIndex)->second; + + } if (strIMType == wxT("aim")){ @@ -348,7 +357,8 @@ void frmContactEditorIM::SetEditorMode(bool EditMode, SectionType SectType) intiter = IMListPrefPtr->find(IMListIndex); - if (intiter->first == IMListIndex && intiter->second > 0){ + if (intiter->first == IMListIndex && intiter->second > 0 && + intiter != IMListPrefPtr->end()){ sliPriority->SetValue(intiter->second); sliPriority->Enable();