fix: gen_snapshot crashes if passed a non-existent file.

Closes https://github.com/dart-lang/sdk/pull/56310

GitOrigin-RevId: 9fa800ae9da26369b6a5cafce726ad881187459f
Change-Id: Ia8911ab67afb65425ad40d3273436420e0cea0ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/377303
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
Eric Seidel
2024-07-24 21:58:10 +00:00
committed by Commit Queue
parent ad33dff4e9
commit ef3252c73d
+5 -2
View File
@@ -316,8 +316,11 @@ PRINTF_ATTRIBUTE(1, 2) static void PrintErrAndExit(const char* format, ...) {
Syslog::VPrintErr(format, args);
va_end(args);
Dart_ExitScope();
Dart_ShutdownIsolate();
// ExitScope and ShutdownIsolate will abort() if there is no current isolate.
if (Dart_CurrentIsolate() != nullptr) {
Dart_ExitScope();
Dart_ShutdownIsolate();
}
exit(kErrorExitCode);
}