Add a null check for suppressed exception.
ScopedExceptionStorage may be used when there is no pending exception.
Test: m
Bug: 233191719
Change-Id: I03c4da8e55a9259e646d2acdacdcf75f107d3f43
diff --git a/runtime/thread.cc b/runtime/thread.cc
index e629b4e..e7c6bec 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -4613,7 +4613,9 @@
CHECK(self_->IsExceptionPending()) << *self_;
ObjPtr<mirror::Throwable> old_suppressed(excp_.Get());
excp_.Assign(self_->GetException());
- LOG(WARNING) << message << "Suppressing old exception: " << old_suppressed->Dump();
+ if (old_suppressed != nullptr) {
+ LOG(WARNING) << message << "Suppressing old exception: " << old_suppressed->Dump();
+ }
self_->ClearException();
}