Fix debug assertion in style manager when "Copy" is clicked with zero styles selected.

Originally committed to SVN as r4105.
This commit is contained in:
Thomas Goyne 2010-02-14 22:44:29 +00:00
parent 429a57ef68
commit e5416f01dc

View file

@ -657,6 +657,7 @@ void DialogStyleManager::OnCopyToCurrent (wxCommandEvent &event) {
void DialogStyleManager::OnStorageCopy (wxCommandEvent &event) { void DialogStyleManager::OnStorageCopy (wxCommandEvent &event) {
wxArrayInt selections; wxArrayInt selections;
StorageList->GetSelections(selections); StorageList->GetSelections(selections);
if (selections.size() == 0) return;
AssStyle *temp = new AssStyle(*(styleStorageMap.at(selections[0]))); AssStyle *temp = new AssStyle(*(styleStorageMap.at(selections[0])));
wxString newName = _("Copy of "); wxString newName = _("Copy of ");
@ -683,6 +684,7 @@ void DialogStyleManager::OnStorageCopy (wxCommandEvent &event) {
void DialogStyleManager::OnCurrentCopy (wxCommandEvent &event) { void DialogStyleManager::OnCurrentCopy (wxCommandEvent &event) {
wxArrayInt selections; wxArrayInt selections;
CurrentList->GetSelections(selections); CurrentList->GetSelections(selections);
if (selections.size() == 0) return;
AssStyle *temp = new AssStyle(styleMap.at(selections[0])->GetEntryData()); AssStyle *temp = new AssStyle(styleMap.at(selections[0])->GetEntryData());
wxString newName = _("Copy of "); wxString newName = _("Copy of ");