Merge "Fix possible nullptr dereference."

This commit is contained in:
Christopher Ferris 2022-02-04 00:22:00 +00:00 committed by Gerrit Code Review
commit 442544d7b4

View file

@ -90,11 +90,13 @@ void UnwindLog(const std::vector<unwindstack::LocalFrameData>& frame_info) {
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();