Fix possible nullptr dereference.

Test: Unit tests pass.
Change-Id: I046c6e1665de4d941362e2f65605609e77731c97
diff --git a/libc/malloc_debug/UnwindBacktrace.cpp b/libc/malloc_debug/UnwindBacktrace.cpp
index dbaebb3..a7036d9 100644
--- a/libc/malloc_debug/UnwindBacktrace.cpp
+++ b/libc/malloc_debug/UnwindBacktrace.cpp
@@ -90,11 +90,13 @@
     std::shared_ptr<unwindstack::MapInfo> map_info = info->map_info;
 
     std::string line = android::base::StringPrintf("          #%0zd  pc %" PAD_PTR "  ", i, info->rel_pc);
-    if (map_info->offset() != 0) {
+    if (map_info != nullptr && map_info->offset() != 0) {
       line += android::base::StringPrintf("(offset 0x%" PRIx64 ") ", map_info->offset());
     }
 
-    if (map_info->name().empty()) {
+    if (map_info == nullptr) {
+      line += "<unknown>";
+    } else if (map_info->name().empty()) {
       line += android::base::StringPrintf("<anonymous:%" PRIx64 ">", map_info->start());
     } else {
       line += map_info->name();