summaryrefslogtreecommitdiffstats
path: root/runtime/mirror
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-04-28 13:53:02 -0700
committerMathieu Chartier <mathieuc@google.com>2015-04-28 14:02:51 -0700
commit4a24858d432331049c416ae6a5993762bfe5e438 (patch)
tree39048cae88792e37debe1925ef9ee805743a27c2 /runtime/mirror
parentb8df6601f2119fd90150761388057dbe893bb6ae (diff)
downloadart-4a24858d432331049c416ae6a5993762bfe5e438.tar.gz
art-4a24858d432331049c416ae6a5993762bfe5e438.tar.bz2
art-4a24858d432331049c416ae6a5993762bfe5e438.zip
Fix possible null deference in Throwable::Dump
Bug: 20640601 Change-Id: Ibd6081ed9ea16f320e505e06e690b8eddb1228ef
Diffstat (limited to 'runtime/mirror')
-rw-r--r--runtime/mirror/throwable.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/mirror/throwable.cc b/runtime/mirror/throwable.cc
index ca9464424b..782b9c0762 100644
--- a/runtime/mirror/throwable.cc
+++ b/runtime/mirror/throwable.cc
@@ -115,10 +115,14 @@ std::string Throwable::Dump() {
} else {
for (int32_t i = 0; i < ste_array->GetLength(); ++i) {
StackTraceElement* ste = ste_array->Get(i);
- result += StringPrintf(" at %s (%s:%d)\n",
- ste->GetMethodName()->ToModifiedUtf8().c_str(),
- ste->GetFileName()->ToModifiedUtf8().c_str(),
- ste->GetLineNumber());
+ DCHECK(ste != nullptr);
+ auto* method_name = ste->GetMethodName();
+ auto* file_name = ste->GetFileName();
+ result += StringPrintf(
+ " at %s (%s:%d)\n",
+ method_name != nullptr ? method_name->ToModifiedUtf8().c_str() : "<unknown method>",
+ file_name != nullptr ? file_name->ToModifiedUtf8().c_str() : "(Unknown Source)",
+ ste->GetLineNumber());
}
}
} else {