From 7cd4ac64e549c65fafbd893cc91be5ffaa82455f Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 10 Feb 2016 01:07:35 +0000 Subject: [PATCH] Fixed potential crash with frmContactEditorRelated 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/frmContactEditorRelated.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/contacteditor/frmContactEditorRelated.cpp b/source/contacteditor/frmContactEditorRelated.cpp index 31bbf7e..04cc162 100644 --- a/source/contacteditor/frmContactEditorRelated.cpp +++ b/source/contacteditor/frmContactEditorRelated.cpp @@ -99,7 +99,8 @@ void frmContactEditorRelated::SetEditorMode(bool EditMode, SectionType SectType) striter = RelatedListRelTypePtr->find(RelatedListIndex); - if (striter->first == RelatedListIndex){ + if (striter->first == RelatedListIndex && + striter != RelatedListRelTypePtr->end()){ strValue = striter->second; @@ -195,7 +196,8 @@ void frmContactEditorRelated::SetEditorMode(bool EditMode, SectionType SectType) intiter = RelatedListPrefPtr->find(RelatedListIndex); - if (intiter->first == RelatedListIndex && intiter->second > 0){ + if (intiter->first == RelatedListIndex && intiter->second > 0 && + intiter != RelatedListPrefPtr->end()){ sliPriority->SetValue(intiter->second); sliPriority->Enable(); -- 2.39.5