Fixed crash with changing font properties via the subtitle edit box when there was a \fs override tag earlier in the line.

Originally committed to SVN as r477.
This commit is contained in:
Rodrigo Braz Monteiro 2006-07-08 22:11:42 +00:00
parent 677cd7d647
commit 3e9d9b79d6
2 changed files with 10 additions and 6 deletions

View File

@ -96,6 +96,7 @@ Please visit http://aegisub.net to download latest version
- Stopping audio playback will now stop video playback as well. (AMZ)
- Implemented sorting of subtitles by start time. (AMZ)
- Recovered subtitle files are now saved in their own subfolder. (AMZ)
- Fixed crash with changing font properties via the subtitle edit box when there was a \fs override tag earlier in the line. (AMZ)
= 1.09 beta - 2006.01.16 ===========================

View File

@ -168,8 +168,9 @@ void VariableData::ResetWith(wxString value) {
// Reads as an int
int VariableData::AsInt() const {
if (!value) throw _T("Null parameter");
if (type != VARDATA_INT) throw _T("Wrong parameter type, should be int");
return *value_int;
if (type == VARDATA_INT) return *value_int;
if (type == VARDATA_FLOAT) return (int)(*value_float);
throw _T("Wrong parameter type, should be int");
}
@ -177,8 +178,9 @@ int VariableData::AsInt() const {
// Reads as a float
double VariableData::AsFloat() const {
if (!value) throw _T("Null parameter");
if (type != VARDATA_FLOAT) throw _T("Wrong parameter type, should be float");
return *value_float;
if (type == VARDATA_FLOAT) return *value_float;
if (type == VARDATA_INT) return (float)(*value_int);
throw _T("Wrong parameter type, should be float");
}
@ -187,8 +189,9 @@ double VariableData::AsFloat() const {
bool VariableData::AsBool() const {
if (!value) throw _T("Null parameter");
if (type == VARDATA_BOOL) return *value_bool;
else if (type == VARDATA_INT) return ((*value_int)!=0);
else throw _T("Wrong parameter type, should be bool");
if (type == VARDATA_INT) return ((*value_int)!=0);
if (type == VARDATA_FLOAT) return ((*value_float)!=0);
throw _T("Wrong parameter type, should be bool");
}