OSDN Git Service

Add NPE check before stopping profiler
authorAmith Yamasani <yamasani@google.com>
Thu, 26 Jan 2017 22:57:20 +0000 (14:57 -0800)
committerAmith Yamasani <yamasani@google.com>
Thu, 26 Jan 2017 22:58:26 +0000 (14:58 -0800)
During crash scenarios, stopProfiling() could be called early.

Change-Id: I6ef78a47e3431dd7c41198ec29d40ebef3928c6a
Fixes: 34744398
Test: N/A

core/java/android/app/ActivityThread.java

index 90fab41..3528dac 100644 (file)
@@ -5032,7 +5032,9 @@ public final class ActivityThread {
      * @hide
      */
     public void stopProfiling() {
-        mProfiler.stopProfiling();
+        if (mProfiler != null) {
+            mProfiler.stopProfiling();
+        }
     }
 
     static final void handleDumpHeap(boolean managed, DumpHeapData dhd) {