File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
src/main/java/soot/dotnet/instructions Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -94,16 +94,19 @@ public Body getFilterHandlerBody(Value generalExceptionVariable) {
94
94
ConditionExpr cond = Jimple .v ().newEqExpr (returnValue , IntConstant .v (0 ));
95
95
IfStmt ifRetCondStmt = Jimple .v ().newIfStmt (cond , filterCondFalseNop ); // if ret==0 ignore handler
96
96
// jump to end of filter instructions - cond true
97
- GotoStmt gotoHandlerBodyCondTrueStmt = Jimple .v ().newGotoStmt (handlerBody .getUnits ().getFirst ());
97
+ if (!handlerBody .getUnits ().isEmpty ()) {
98
+ //this may happen when there is an empty handler
99
+ GotoStmt gotoHandlerBodyCondTrueStmt = Jimple .v ().newGotoStmt (handlerBody .getUnits ().getFirst ());
98
100
99
- handlerFilterContainerBlockBody .getUnits ().insertAfter (gotoHandlerBodyCondTrueStmt , returnStmt );
101
+ handlerFilterContainerBlockBody .getUnits ().insertAfter (gotoHandlerBodyCondTrueStmt , returnStmt );
102
+ }
100
103
handlerFilterContainerBlockBody .getUnits ().swapWith (returnStmt , ifRetCondStmt );
101
104
dotnetBody .blockEntryPointsManager .swapGotoEntryUnit (ifRetCondStmt , returnStmt );
102
105
}
103
106
jb .getUnits ().addAll (handlerFilterContainerBlockBody .getUnits ());
104
107
105
108
// handler body
106
- if (lastStmtIsNotReturn (handlerBody )) {
109
+ if (handlerBody . getUnits (). isEmpty () || lastStmtIsNotReturn (handlerBody )) {
107
110
// if last stmt is not return, insert goto stmt, to go to end whole block
108
111
handlerBody .getUnits ().add (Jimple .v ().newGotoStmt (nopStmtEnd ));
109
112
}
You can’t perform that action at this time.
0 commit comments