fix "0 // foo" -> true

This commit is contained in:
Glenn Maynard
2004-12-06 06:41:31 +00:00
parent f0c9196995
commit 394982b461
+8 -2
View File
@@ -685,9 +685,15 @@ float ThemeManager::GetMetricF( const CString &sClassName, const CString &sValue
bool ThemeManager::GetMetricB( const CString &sClassName, const CString &sValueName )
{
CString sValue = GetMetricRaw( sClassName,sValueName );
if( sValue == "0" )
/* Watch out: "0" and "1" are not false and true in Lua (all string values are
* true). Make sure that we catch all values that are supposed to be simple
* booleans. */
TrimLeft( sValue );
TrimRight( sValue );
if( sValue.Left(1) == "0" )
return false; /* optimization */
if( sValue == "1" )
if( sValue.Left(1) == "1" )
return true; /* optimization */
Lua::PrepareExpression( sValue );