[VM/Runtime] Ensure an isolate exists before calling Dart_ShutdownIsolate()
Fixes https://github.com/dart-lang/sdk/issues/52892 TEST=ci Change-Id: I4f0aa64642d4ba8416ef353dfca7371adc7e6bba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313543 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is contained in:
@@ -21,7 +21,11 @@ void ErrorExit(int exit_code, const char* format, ...) {
|
||||
Syslog::VPrintErr(format, arguments);
|
||||
va_end(arguments);
|
||||
|
||||
Dart_ShutdownIsolate();
|
||||
// Sometimes ErrorExit is called even before we have entered an isolate.
|
||||
// We need to shutdown the isolate only if one exists.
|
||||
if (Dart_CurrentIsolate() != nullptr) {
|
||||
Dart_ShutdownIsolate();
|
||||
}
|
||||
|
||||
// Terminate process exit-code handler.
|
||||
Process::TerminateExitCodeHandler();
|
||||
|
||||
Reference in New Issue
Block a user