Skip to content

Commit a09342a

Browse files
committed
Fix NPE
1 parent 5c06b0a commit a09342a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

soot-infoflow-android/src/soot/jimple/infoflow/android/entryPointCreators/AndroidEntryPointCreator.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,16 @@ protected SootMethod createDummyMainInternal() {
291291
applicationClassUse = applicationClass;
292292
}
293293
localVarsForClasses.put(applicationClass, applicationLocal);
294+
SootClass cw = Scene.v().getSootClassUnsafe(AndroidEntryPointConstants.CONTEXT_WRAPPER);
295+
if (cw == null) {
296+
//use application local type as a fallback, since this class also implements context wrapper
297+
cw = ((RefType) applicationLocal.getType()).getSootClass();
298+
}
299+
if (cw != null)
300+
body.getUnits().add(j.newInvokeStmt(j.newVirtualInvokeExpr(applicationLocal,
301+
Scene.v().makeMethodRef(cw, AndroidEntryPointConstants.ATTACH_BASE_CONTEXT, false))));
294302
}
295303

296-
SootClass cw = Scene.v().getSootClassUnsafe(AndroidEntryPointConstants.CONTEXT_WRAPPER);
297-
if (cw == null) {
298-
//use application local type as a fallback, since this class also implements context wrapper
299-
cw = ((RefType) applicationLocal.getType()).getSootClass();
300-
}
301-
if (cw != null)
302-
body.getUnits().add(j.newInvokeStmt(j.newVirtualInvokeExpr(applicationLocal,
303-
Scene.v().makeMethodRef(cw, AndroidEntryPointConstants.ATTACH_BASE_CONTEXT, false))));
304-
305304
Map<SootClass, ContentProviderEntryPointCreator> cpComponents = new HashMap<>();
306305
// For some weird reason unknown to anyone except the flying spaghetti
307306
// monster, the onCreate() methods of content providers run even before

0 commit comments

Comments
 (0)