Skip to content

Commit 969648c

Browse files
committedAug 30, 2018
fixed an NPE
1 parent 1fe168b commit 969648c

File tree

1 file changed

+17
-22
lines changed

1 file changed

+17
-22
lines changed
 

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

+17-22
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,8 @@ public class AndroidEntryPointCreator extends AbstractAndroidEntryPointCreator i
9191
* registers a list of classes to be automatically scanned for Android lifecycle
9292
* methods
9393
*
94-
* @param components
95-
* The list of classes to be automatically scanned for Android
96-
* lifecycle methods
94+
* @param components The list of classes to be automatically scanned for Android
95+
* lifecycle methods
9796
*/
9897
public AndroidEntryPointCreator(ProcessManifest manifest, Collection<SootClass> components) {
9998
this.manifest = manifest;
@@ -325,8 +324,8 @@ private void initializeApplicationClass() {
325324
for (SootMethod smCallback : callbacks) {
326325
// Is this a special callback class? We have callbacks that model activity
327326
// lifecycle events and ones that model generic events (e.g., low memory)
328-
if (Scene.v().getOrMakeFastHierarchy().canStoreType(smCallback.getDeclaringClass().getType(),
329-
scActCallbacks.getType()))
327+
if (scActCallbacks != null && Scene.v().getOrMakeFastHierarchy()
328+
.canStoreType(smCallback.getDeclaringClass().getType(), scActCallbacks.getType()))
330329
activityLifecycleCallbacks.put(smCallback.getDeclaringClass(), smCallback.getSignature());
331330
else
332331
applicationCallbackClasses.put(smCallback.getDeclaringClass(), smCallback.getSignature());
@@ -357,8 +356,7 @@ private void initializeApplicationClass() {
357356
/**
358357
* Removes if statements that jump to the fall-through successor
359358
*
360-
* @param body
361-
* The body from which to remove unnecessary if statements
359+
* @param body The body from which to remove unnecessary if statements
362360
*/
363361
private void eliminateFallthroughIfs(Body body) {
364362
boolean changed = false;
@@ -382,10 +380,10 @@ private void eliminateFallthroughIfs(Body body) {
382380
/**
383381
* Adds calls to the callback methods defined in the application class
384382
*
385-
* @param applicationClass
386-
* The class in which the user-defined application is implemented
387-
* @param applicationLocal
388-
* The local containing the instance of the user-defined application
383+
* @param applicationClass The class in which the user-defined application is
384+
* implemented
385+
* @param applicationLocal The local containing the instance of the user-defined
386+
* application
389387
*/
390388
private void addApplicationCallbackMethods() {
391389
if (!this.callbackFunctions.containsKey(applicationClass))
@@ -473,11 +471,10 @@ public ComponentEntryPointCollection getComponentToEntryPointInfo() {
473471
* Sets the list of callback functions to be integrated into the Android
474472
* lifecycle
475473
*
476-
* @param callbackFunctions
477-
* The list of callback functions to be integrated into the Android
478-
* lifecycle. This is a mapping from the Android element class
479-
* (activity, service, etc.) to the list of callback methods for that
480-
* element.
474+
* @param callbackFunctions The list of callback functions to be integrated into
475+
* the Android lifecycle. This is a mapping from the
476+
* Android element class (activity, service, etc.) to
477+
* the list of callback methods for that element.
481478
*/
482479
public void setCallbackFunctions(MultiMap<SootClass, SootMethod> callbackFunctions) {
483480
this.callbackFunctions = callbackFunctions;
@@ -522,9 +519,8 @@ public void reset() {
522519
/**
523520
* Sets the Android components for which a dummy main method shall be created
524521
*
525-
* @param components
526-
* The Android components for which a dummy main method shall be
527-
* created
522+
* @param components The Android components for which a dummy main method shall
523+
* be created
528524
*/
529525
public void setComponents(Collection<SootClass> components) {
530526
this.components = components;
@@ -533,9 +529,8 @@ public void setComponents(Collection<SootClass> components) {
533529
/**
534530
* Removes all methods that have been generated by this entry point creator
535531
*
536-
* @param removeClass
537-
* True if the generated class shall also be removed. False to only
538-
* remove the methods, but keep the class
532+
* @param removeClass True if the generated class shall also be removed. False
533+
* to only remove the methods, but keep the class
539534
*/
540535
public void removeGeneratedMethods(boolean removeClass) {
541536
// Remove the dummy main method itself

0 commit comments

Comments
 (0)