OSDN Git Service

Fix NPE in NsdServiceTest
authorHugo Benichi <hugobenichi@google.com>
Tue, 26 Sep 2017 05:51:11 +0000 (14:51 +0900)
committerHugo Benichi <hugobenichi@google.com>
Thu, 28 Sep 2017 06:22:13 +0000 (15:22 +0900)
Continuous test dashboards report that quit() can crash sometimes
due to mThread being null.

This patch adds a null guard in tearDown().

Bug: 32561414
Test: runtest frameworks-net
Change-Id: If66fb47e31e77d25b4741a786f12eb78f0b9102e

tests/net/java/com/android/server/NsdServiceTest.java

index 2e49c98..b88c784 100644 (file)
@@ -77,7 +77,10 @@ public class NsdServiceTest {
 
     @After
     public void tearDown() throws Exception {
-        mThread.quit();
+        if (mThread != null) {
+            mThread.quit();
+            mThread = null;
+        }
     }
 
     @Test