Fix NPE in InstrumentationTestRunner
This fixes a problem where the test runner would die when a
test case has tests that are not methods of the test class.
Change-Id: I5adc464bb4a0c8d282428895e422a47dcb6bfe1f
diff --git a/test-runner/src/android/test/InstrumentationTestRunner.java b/test-runner/src/android/test/InstrumentationTestRunner.java
index 3ac74f7..5ce3efc 100644
--- a/test-runner/src/android/test/InstrumentationTestRunner.java
+++ b/test-runner/src/android/test/InstrumentationTestRunner.java
@@ -785,7 +785,7 @@
mIncludeDetailedStats = false;
try {
// Look for TimedTest annotation on both test class and test method
- if (testMethod.isAnnotationPresent(TimedTest.class)) {
+ if (testMethod != null && testMethod.isAnnotationPresent(TimedTest.class)) {
mIsTimedTest = true;
mIncludeDetailedStats = testMethod.getAnnotation(
TimedTest.class).includeDetailedStats();