Merge "Check whether media recorder client exists before dumping." into ics-mr0
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index b5eef94..3ebe989 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -374,11 +374,13 @@
         } else {
             for (int i = 0, n = mMediaRecorderClients.size(); i < n; ++i) {
                 sp<MediaRecorderClient> c = mMediaRecorderClients[i].promote();
-                snprintf(buffer, 255, " MediaRecorderClient pid(%d)\n", c->mPid);
-                result.append(buffer);
-                write(fd, result.string(), result.size());
-                result = "\n";
-                c->dump(fd, args);
+                if (c != 0) {
+                    snprintf(buffer, 255, " MediaRecorderClient pid(%d)\n", c->mPid);
+                    result.append(buffer);
+                    write(fd, result.string(), result.size());
+                    result = "\n";
+                    c->dump(fd, args);
+                }
             }
         }