- wxCommand *command = (wxCommand *)m_currentCommand->Data();
- wxString commandName(command->GetName());
- if (commandName == "") commandName = _("Unnamed command");
- bool canUndo = command->CanUndo();
- if (canUndo)
- buf = wxString(_("&Undo ")) + commandName;
- else
- buf = wxString(_("Can't &Undo ")) + commandName;
-
- m_commandEditMenu->SetLabel(wxID_UNDO, buf);
- m_commandEditMenu->Enable(wxID_UNDO, canUndo);
-
- // We can redo, if we're not at the end of the history.
- if (m_currentCommand->Next())
- {
- wxCommand *redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
- wxString redoCommandName(redoCommand->GetName());
- if (redoCommandName == "") redoCommandName = _("Unnamed command");
- buf = wxString(_("&Redo ")) + redoCommandName;
- m_commandEditMenu->SetLabel(wxID_REDO, buf);
- m_commandEditMenu->Enable(wxID_REDO, TRUE);
- }
- else
- {
- m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo"));
- m_commandEditMenu->Enable(wxID_REDO, FALSE);
- }
- }
- else
- {
- m_commandEditMenu->SetLabel(wxID_UNDO, _("&Undo"));
- m_commandEditMenu->Enable(wxID_UNDO, FALSE);
+ wxString buf;
+ if (m_currentCommand)
+ {
+ wxCommand *command = (wxCommand *)m_currentCommand->Data();
+ wxString commandName(command->GetName());
+ if (commandName == _T("")) commandName = _("Unnamed command");
+ bool canUndo = command->CanUndo();
+ if (canUndo)
+ buf = wxString(_("&Undo ")) + commandName;
+ else
+ buf = wxString(_("Can't &Undo ")) + commandName;
+
+ m_commandEditMenu->SetLabel(wxID_UNDO, buf);
+ m_commandEditMenu->Enable(wxID_UNDO, canUndo);
+
+ // We can redo, if we're not at the end of the history.
+ if (m_currentCommand->Next())
+ {
+ wxCommand *redoCommand = (wxCommand *)m_currentCommand->Next()->Data();
+ wxString redoCommandName(redoCommand->GetName());
+ if (redoCommandName == _T("")) redoCommandName = _("Unnamed command");
+ buf = wxString(_("&Redo ")) + redoCommandName;
+ m_commandEditMenu->SetLabel(wxID_REDO, buf);
+ m_commandEditMenu->Enable(wxID_REDO, TRUE);
+ }
+ else
+ {
+ m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo"));
+ m_commandEditMenu->Enable(wxID_REDO, FALSE);
+ }
+ }
+ else
+ {
+ m_commandEditMenu->SetLabel(wxID_UNDO, _("&Undo"));
+ m_commandEditMenu->Enable(wxID_UNDO, FALSE);