Permalink
Browse files

2005-12-14 Miguel de Icaza <miguel@novell.com>

	* convert.cs (ExplicitConversionCore): Check the return value from
	ExplicitConversionCore which can return null on failure.  Fixes #76914

svn path=/trunk/mcs/; revision=54368
  • Loading branch information...
1 parent b089a9f commit 75a5d620f1dafbbfd1ad295a579ffa7d40721e62 @migueldeicaza migueldeicaza committed Dec 14, 2005
Showing with 11 additions and 3 deletions.
  1. +5 −0 mcs/mcs/ChangeLog
  2. +6 −3 mcs/mcs/convert.cs
View
@@ -1,3 +1,8 @@
+2005-12-14 Miguel de Icaza <miguel@novell.com>
+
+ * convert.cs (ExplicitConversionCore): Check the return value from
+ ExplicitConversionCore which can return null on failure. Fixes #76914
+
2005-12-13 Marek Safar <marek.safar@seznam.cz>
* class.cs (Method.ApplyAttributeBuilder): Test out modifier properly.
View
@@ -1679,7 +1679,7 @@ static Expression ExplicitReferenceConversion (Expression source, Type target_ty
/// type is expr.Type to `target_type'.
/// </summary>
static public Expression ExplicitConversionCore (EmitContext ec, Expression expr,
- Type target_type, Location loc)
+ Type target_type, Location loc)
{
Type expr_type = expr.Type;
@@ -1701,8 +1701,11 @@ static Expression ExplicitReferenceConversion (Expression source, Type target_ty
return ExplicitConversionCore (ec, new EmptyCast (expr, TypeManager.EnumToUnderlying (expr_type)), target_type, loc);
}
- if (TypeManager.IsEnumType (target_type))
- return new EmptyCast (ExplicitConversionCore (ec, expr, TypeManager.EnumToUnderlying (target_type), loc), target_type);
+ if (TypeManager.IsEnumType (target_type)){
+ Expression ce = ExplicitConversionCore (ec, expr, TypeManager.EnumToUnderlying (target_type), loc);
+ if (ce != null)
+ return new EmptyCast (ce, target_type);
+ }
ne = ExplicitNumericConversion (expr, target_type);
if (ne != null)

0 comments on commit 75a5d62

Please sign in to comment.