Skip to content

Commit 089ea26

Browse files
committed
Fixing hanlders only when there is last il ret call
1 parent b1049a4 commit 089ea26

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Weaver/Xtensive.Orm.Weaver/Tasks/ImplementInitializablePatternTask.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ public override ActionResult Execute(ProcessorContext context)
3838
il.Append(ret);
3939
il.Replace(leavePlaceholder, il.Create(OpCodes.Leave, ret));
4040
if (body.ExceptionHandlers.Count != 0) {
41-
foreach (var eHandler in body.ExceptionHandlers) {
42-
FixCatchLeave(eHandler.HandlerStart, eHandler.HandlerEnd, originalLastRet, initializeCall);
43-
}
41+
if (originalLastRet != null)
42+
foreach (var eHandler in body.ExceptionHandlers) {
43+
FixCatchLeave(eHandler.HandlerStart, eHandler.HandlerEnd, originalLastRet, initializeCall);
44+
}
4445
}
4546

4647
body.InitLocals = true;

0 commit comments

Comments
 (0)