summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2014-01-31 18:44:56 -0800
committerLorDClockaN <davor@losinj.com>2014-06-03 16:28:26 +0200
commite03b2e2f0ddb47f3afbd4b37df9dbb75fe9d2af8 (patch)
tree779fca20f760816a0a9b985ed7f00e562f1b143f
parentea70d989d1df56b0d9857a36afa36d833449c7da (diff)
Properly tolerate missing declaring source fileskitkat
Broken in 228d6b8a4f0a21c1e9b2372c3104ce4ee19f65b4 (cherry picked from commit 7c6aca27dd2df58ac3d83a93ec5848e2b7d3159a) Bug: 13575571 Bug: 12802375 Change-Id: Ia8a3196b15f8ed29810d0b6f09f81c7ae4e7480e
-rw-r--r--runtime/thread.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 7fd40c945c..25418a9758 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1414,8 +1414,8 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray(JNIEnv* env, job
mirror::ArtMethod* method = down_cast<mirror::ArtMethod*>(method_trace->Get(i));
MethodHelper mh(method);
int32_t line_number;
- SirtRef<mirror::String> class_name_object(soa.Self(), NULL);
- SirtRef<mirror::String> source_name_object(soa.Self(), NULL);
+ SirtRef<mirror::String> class_name_object(soa.Self(), nullptr);
+ SirtRef<mirror::String> source_name_object(soa.Self(), nullptr);
if (method->IsProxyMethod()) {
line_number = -1;
class_name_object.reset(method->GetDeclaringClass()->GetName());
@@ -1427,16 +1427,18 @@ jobjectArray Thread::InternalStackTraceToStackTraceElementArray(JNIEnv* env, job
// Allocate element, potentially triggering GC
// TODO: reuse class_name_object via Class::name_?
const char* descriptor = mh.GetDeclaringClassDescriptor();
- CHECK(descriptor != NULL);
+ CHECK(descriptor != nullptr);
std::string class_name(PrettyDescriptor(descriptor));
class_name_object.reset(mirror::String::AllocFromModifiedUtf8(soa.Self(), class_name.c_str()));
- if (class_name_object.get() == NULL) {
- return NULL;
+ if (class_name_object.get() == nullptr) {
+ return nullptr;
}
const char* source_file = mh.GetDeclaringClassSourceFile();
- source_name_object.reset(mirror::String::AllocFromModifiedUtf8(soa.Self(), source_file));
- if (source_name_object.get() == NULL) {
- return NULL;
+ if (source_file != nullptr) {
+ source_name_object.reset(mirror::String::AllocFromModifiedUtf8(soa.Self(), source_file));
+ if (source_name_object.get() == nullptr) {
+ return nullptr;
+ }
}
}
const char* method_name = mh.GetName();