From: Steve Brokenshire Date: Tue, 9 Feb 2016 23:38:08 +0000 (+0000) Subject: Fixed potential crash in frmContactEditorAddress in Edit mode. X-Git-Tag: release-0.09~33 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=be85301ffda484bcfc0c0576f467a6f56f2f2bb6;p=xestiaab%2F.git Fixed potential crash in frmContactEditorAddress 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/frmContactEditorAddress.cpp b/source/contacteditor/frmContactEditorAddress.cpp index 921ce48..1556618 100644 --- a/source/contacteditor/frmContactEditorAddress.cpp +++ b/source/contacteditor/frmContactEditorAddress.cpp @@ -388,7 +388,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListPtr->end()){ txtAddress->SetValue(striter->second); @@ -396,7 +397,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListTownPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListTownPtr->end()){ txtTownCity->SetValue(striter->second); @@ -404,7 +406,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListCountyPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListCountyPtr->end()){ txtCounty->SetValue(striter->second); @@ -412,7 +415,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListPostCodePtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListPostCodePtr->end()){ txtPostCode->SetValue(striter->second); @@ -420,7 +424,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListCountryPtr->find(AddressListIndex); - if (striter->first == AddressListIndex){ + if (striter->first == AddressListIndex && + striter != AddressListCountryPtr->end()){ txtCountry->SetValue(striter->second); @@ -433,7 +438,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType intiter = AddressListPrefPtr->find(AddressListIndex); - if (intiter->first == AddressListIndex && intiter->second > 0 && intiter != AddressListPrefPtr->end()){ + if (intiter->first == AddressListIndex && intiter->second > 0 && intiter != AddressListPrefPtr->end() && + intiter != AddressListPrefPtr->end()){ sliPriority->SetValue(intiter->second); sliPriority->Enable(); @@ -445,7 +451,8 @@ void frmContactEditorAddress::SetEditorMode( bool EditMode, SectionType SectType striter = AddressListLabelPtr->find(AddressListIndex); - if (striter->first == AddressListIndex && striter != AddressListLabelPtr->end()){ + if (striter->first == AddressListIndex && striter != AddressListLabelPtr->end() && + striter != AddressListLabelPtr->end()){ strValue = striter->second; if (strValue.Left(1) == "\"" && strValue.Right(1) == "\""){