From fc5f22838afc80ae2e670ff478ad58bdf87fc165 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Tue, 9 Feb 2016 23:53:47 +0000 Subject: [PATCH] Fixed potential crash with frmContactEditorKey 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/frmContactEditorKey.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/source/contacteditor/frmContactEditorKey.cpp b/source/contacteditor/frmContactEditorKey.cpp index c80642b..569b0c3 100644 --- a/source/contacteditor/frmContactEditorKey.cpp +++ b/source/contacteditor/frmContactEditorKey.cpp @@ -113,7 +113,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) striter = KeyListDataTypePtr->find(KeyListIndex); - if (striter->first == KeyListIndex){ + if (striter->first == KeyListIndex && + striter != KeyListDataTypePtr->end()){ strValue = striter->second; @@ -152,7 +153,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) striter = KeyListDataTypePtr->find(KeyListIndex); - if (striter->first == KeyListIndex){ + if (striter->first == KeyListIndex && + striter != KeyListDataTypePtr->end()){ strValue = striter->second; @@ -168,7 +170,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) striter = KeyListTypePtr->find(KeyListIndex); - if (striter->first == KeyListIndex){ + if (striter->first == KeyListIndex && + striter != KeyListTypePtr->end()){ strValue = striter->second; @@ -192,7 +195,8 @@ void frmContactEditorKey::SetEditorMode(bool EditMode) intiter = KeyListPrefPtr->find(KeyListIndex); - if (intiter->first == KeyListIndex && intiter->second > 0){ + if (intiter->first == KeyListIndex && intiter->second > 0 && + intiter != KeyListPrefPtr->end()){ sliPriority->SetValue(intiter->second); sliPriority->Enable(); -- 2.39.2