[Windows] Handle crashes without exception (#912)

* Handle that exception_pointers can be null

* Fix formatting

* windows: Handle crashes without exception
This commit is contained in:
Max Ammann 2022-12-10 01:29:27 +01:00 committed by GitHub
parent f9eac18542
commit 2f9b279428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1294,20 +1294,22 @@ mod windows_exception_handler {
compiler_fence(Ordering::SeqCst); compiler_fence(Ordering::SeqCst);
} }
let code = ExceptionCode::try_from(
exception_pointers
.as_mut()
.unwrap()
.ExceptionRecord
.as_mut()
.unwrap()
.ExceptionCode
.0,
)
.unwrap();
#[cfg(feature = "std")] #[cfg(feature = "std")]
eprintln!("Crashed with {}", code); if let Some(exception_pointers) = exception_pointers.as_mut() {
let code = ExceptionCode::try_from(
exception_pointers
.ExceptionRecord
.as_mut()
.unwrap()
.ExceptionCode
.0,
)
.unwrap();
eprintln!("Crashed with {}", code);
} else {
eprintln!("Crashed without exception (probably due to SIGABRT)");
};
if data.current_input_ptr.is_null() { if data.current_input_ptr.is_null() {
#[cfg(feature = "std")] #[cfg(feature = "std")]
{ {