Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
frmContactEditor: Stop XAB crashing when pressing Modify/Delete
[xestiaab/.git] / source / contacteditor / frmContactEditorXToken.cpp
index 5474373..7d0d261 100644 (file)
@@ -1,3 +1,21 @@
+// frmContactEditorXToken.cpp - frmContactEditorXToken form.
+//
+// (c) 2012-2015 Xestia Software Development.
+//
+// This file is part of Xestia Address Book.
+//
+// Xestia Address Book is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Address Book is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
+
 #include "frmContactEditorXToken.h"
 #include <wx/tokenzr.h>
 #include "../common/textprocessing.h"
@@ -12,6 +30,8 @@ frmContactEditorXTokenADT( parent )
 void frmContactEditorXToken::ProcessAction( wxCommandEvent& event )
 {
 
+       // Process action.
+       
        long ListCtrlIndex;
        
        if (EditorMode == FALSE){
@@ -100,7 +120,8 @@ void frmContactEditorXToken::SetEditorMode(bool EditMode)
                
                striter = XTokenListTokensPtr->find(XTokenListIndex);
                 
-               if (striter->first == XTokenListIndex){
+               if (striter->first == XTokenListIndex &&
+                       striter != XTokenListTokensPtr->end()){
                
                        strValue = striter->second;
                
@@ -114,7 +135,8 @@ void frmContactEditorXToken::SetEditorMode(bool EditMode)
 
                striter = XTokenListPtr->find(XTokenListIndex);
                 
-               if (striter->first == XTokenListIndex){
+               if (striter->first == XTokenListIndex &&
+                       striter != XTokenListPtr->end()){
                
                        strValue = striter->second;
                
@@ -134,6 +156,8 @@ void frmContactEditorXToken::SetupPointers( std::map<int, wxString> *XTokenList,
                        int XTokenIndex )
 {
 
+       // Setup the pointers.
+       
        XTokenListPtr = XTokenList;
        XTokenListTokensPtr = XTokenListTokens;
        XTokenListCtrlPtr = XTokenListCtrl;
@@ -143,5 +167,8 @@ void frmContactEditorXToken::SetupPointers( std::map<int, wxString> *XTokenList,
 
 void frmContactEditorXToken::CloseWindow( wxCommandEvent& event )
 {
+       
+       // Close the window.
+       
        this->Close();
 }
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy