Don't throw exceptions from destructors

This commit is contained in:
Thomas Goyne 2013-01-01 20:54:50 -08:00
parent faad79479f
commit b1cd2db023

View file

@ -96,7 +96,7 @@ public:
} }
} }
~parser() { void check_done() const {
if (tkn_idx != tkns.size()) if (tkn_idx != tkns.size())
throw SubtitleFormatParseError("Malformed style: too many fields", 0); throw SubtitleFormatParseError("Malformed style: too many fields", 0);
} }
@ -136,7 +136,8 @@ public:
} }
AssStyle::AssStyle(wxString const& rawData, int version) { AssStyle::AssStyle(wxString const& rawData, int version) {
parser p(from_wx(rawData)); std::string str(from_wx(rawData));
parser p(str);
name = p.next_str(); name = p.next_str();
font = p.next_str(); font = p.next_str();
@ -201,6 +202,8 @@ AssStyle::AssStyle(wxString const& rawData, int version) {
encoding = p.next_int(); encoding = p.next_int();
p.check_done();
UpdateData(); UpdateData();
} }