From 06138ee325090ff6a1e4c8e6c6d318f789862b6a Mon Sep 17 00:00:00 2001 From: coppro Date: Wed, 23 May 2007 00:47:18 +0000 Subject: [PATCH] Made spec_sort specifications featuring more than one '()' not hang. Added error window if a script error occurs while loading a set. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@412 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/new_window.cpp | 5 +++++ src/script/functions/basic.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/new_window.cpp b/src/gui/new_window.cpp index a78e00fc..9c0c3eb7 100644 --- a/src/gui/new_window.cpp +++ b/src/gui/new_window.cpp @@ -91,10 +91,15 @@ void NewSetWindow::OnOK(wxCommandEvent&) { } void NewSetWindow::done() { + try { StyleSheetP stylesheet = stylesheet_list->getSelection(); set = new_intrusive1(stylesheet); set->validate(); EndModal(wxID_OK); + } catch (Error& e) { + handle_error(e); + throw; // We want to crash. + } } void NewSetWindow::onUpdateUI(wxUpdateUIEvent& ev) { diff --git a/src/script/functions/basic.cpp b/src/script/functions/basic.cpp index 712d0c34..ad946b0d 100644 --- a/src/script/functions/basic.cpp +++ b/src/script/functions/basic.cpp @@ -510,7 +510,7 @@ String spec_sort(const String& spec, const String& input) { pos = end; } else if (c == _('(')) { // in a cycle - size_t end = spec.find_first_of(_(')')); + size_t end = spec.find_first_of(_(')'), pos); if (end == String::npos) throw ParseError(_("Expected ')' in sort_rule specification")); ret += cycle_sort(spec.substr(pos + 1, end - pos - 1), input); pos = end;