Skip to content

Commit 5110d82

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm] Fix error notification when unable to print the stacktrace.
TEST=run test harness with low heap limit Change-Id: I8084c50c3aab1c0cbfa32bbcc5df100abe4211bc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213537 Reviewed-by: Alexander Aprelev <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 9605ca2 commit 5110d82

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

runtime/vm/isolate.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,8 +2315,12 @@ bool Isolate::NotifyErrorListeners(const char* message,
23152315
msg.value.as_string = const_cast<char*>(message);
23162316
arr_values[0] = &msg;
23172317
Dart_CObject stack;
2318-
stack.type = Dart_CObject_kString;
2319-
stack.value.as_string = const_cast<char*>(stacktrace);
2318+
if (stacktrace == NULL) {
2319+
stack.type = Dart_CObject_kNull;
2320+
} else {
2321+
stack.type = Dart_CObject_kString;
2322+
stack.value.as_string = const_cast<char*>(stacktrace);
2323+
}
23202324
arr_values[1] = &stack;
23212325

23222326
SendPort& listener = SendPort::Handle(current_zone());

runtime/vm/message_snapshot.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3162,6 +3162,7 @@ bool ApiMessageSerializer::Trace(Dart_CObject* object) {
31623162
cid = kDoubleCid;
31633163
break;
31643164
case Dart_CObject_kString: {
3165+
RELEASE_ASSERT(object->value.as_string != NULL);
31653166
const uint8_t* utf8_str =
31663167
reinterpret_cast<const uint8_t*>(object->value.as_string);
31673168
intptr_t utf8_len = strlen(object->value.as_string);

0 commit comments

Comments
 (0)