java.lang.NullPointerException alyunOS
In com.sumxiang.noteapp:1.0:2.
- FAILURE:
  java.lang.NullPointerException: java.lang.NullPointerException
  at com.squareup.leakcanary.HahaHelper.classInstanceValues(HahaHelper.java:143)
  at com.squareup.leakcanary.HahaHelper.asString(HahaHelper.java:73)
  at com.squareup.leakcanary.HahaHelper.threadName(HahaHelper.java:55)
  at com.squareup.leakcanary.ShortestPathFinder.enqueueGcRoots(ShortestPathFinder.java:133)
  at com.squareup.leakcanary.ShortestPathFinder.findPath(ShortestPathFinder.java:82)
  at com.squareup.leakcanary.HeapAnalyzer.findLeakTrace(HeapAnalyzer.java:112)
  at com.squareup.leakcanary.HeapAnalyzer.checkForLeak(HeapAnalyzer.java:87)
  at com.squareup.leakcanary.internal.HeapAnalyzerService.onHandleIntent(HeapAnalyzerService.java:58)
  at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:136)
  at android.os.HandlerThread.run(HandlerThread.java:61)
- Reference Key: 17ea16ba-cb43-4a23-bd9e-18c6ad09b2d2
- Device: Xiaomi Xiaomi HM 1SW armani
- Android Version: 4.4.4 API: 19 LeakCanary: 1.4-beta1 02804f3
- Durations: watch=5018ms, gc=123ms, heap dump=580ms, analysis=4082ms
- Excluded Refs:
  | Field: android.app.ActivityThread$ActivityClientRecord.nextIdle
  | Field: android.widget.Editor$EasyEditSpanController.this$0
  | Field: android.widget.Editor$SpanController.this$0
  | Field: android.os.Message.obj
  | Field: android.os.Message.next
  | Field: android.os.Message.target
  | Field: android.view.inputmethod.InputMethodManager.mNextServedView
  | Field: android.view.inputmethod.InputMethodManager.mServedView
  | Field: android.view.inputmethod.InputMethodManager.mServedInputConnection
  | Field: android.view.inputmethod.InputMethodManager.mCurRootView
  | Field: android.animation.LayoutTransition$1.val$parent
  | Field: android.view.textservice.SpellCheckerSession$1.this$0
  | Field: android.support.v7.internal.widget.ActivityChooserModel.mActivityChoserModelPolicy
  | Field: android.widget.ActivityChooserModel.mActivityChoserModelPolicy
  | Field: android.speech.SpeechRecognizer$InternalListener.this$0
  | Field: android.accounts.AccountManager$AmsTask$Response.this$1
  | Field: android.media.MediaScannerConnection.mContext
  | Field: android.os.UserManager.mContext
  | Field: android.appwidget.AppWidgetHost$Callbacks.this$0
  | Field: android.media.AudioManager$1.this$0
  | Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
  | Static field: android.text.TextLine.sCached
  | Thread:FinalizerWatchdogDaemon (always)
  | Thread:main (always)
  | Thread:LeakCanary-Heap-Dump (always)
  | Class:java.lang.ref.WeakReference (always)
  | Class:java.lang.ref.SoftReference (always)
  | Class:java.lang.ref.PhantomReference (always)
  | Class:java.lang.ref.Finalizer (always)
  | Class:java.lang.ref.FinalizerReference (always)
  | Root Class:android.os.Binder (always)
  dump http://pan.baidu.com/s/1c0KU7y4

diff --git a/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/HahaHelper.java b/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/HahaHelper.java
index fbbf8ba08..fe01cd23b 100644
--- a/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/HahaHelper.java
+++ b/leakcanary-analyzer/src/main/java/com/squareup/leakcanary/HahaHelper.java
@@ -52,6 +52,11 @@ public final class HahaHelper {
   static String threadName(Instance holder) {
     List<ClassInstance.FieldValue> values = classInstanceValues(holder);
     Object nameField = fieldValue(values, "name");
+    if (nameField == null) {
+      // Sometimes we can't find the String at the expected memory address in the heap dump.
+      // See https://github.com/square/leakcanary/issues/417 .
+      return "Thread name not available";
+    }
     return asString(nameField);
   }
 
['leakcanary-analyzer/src/main/java/com/squareup/leakcanary/HahaHelper.java']