From c612fb7241f0e7b8736745da18af62458e2c2e32 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 9 Feb 2016 23:51:30 +0000 Subject: [PATCH] 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. --- source/contacteditor/frmContactEditorIM.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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(); -- 2.39.5