**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
// delete all non-modified documents
wxList& rListDocs = theApp->getDocManager()->GetDocuments();
for (wxNode* pNode = rListDocs.GetFirst(); pNode != NULL; pNode = pNode->GetNext()) {
// delete all non-modified documents
wxList& rListDocs = theApp->getDocManager()->GetDocuments();
for (wxNode* pNode = rListDocs.GetFirst(); pNode != NULL; pNode = pNode->GetNext()) {
- wxDocument* pDoc = static_cast<wxDocument*>(pNode->GetData());
- if (! pDoc->IsModified()) {
- GetDocumentManager()->RemoveDocument(pDoc);
+ wxDocument* pDoc = dynamic_cast<wxDocument*>(pNode->GetData());
+ if (pDoc && ! pDoc->IsModified()) {
+ theApp->getDocManager()->RemoveDocument(pDoc);