diff --git a/hipamd/src/hip_stream.cpp b/hipamd/src/hip_stream.cpp index f3dceeae80..fa471f3ee5 100644 --- a/hipamd/src/hip_stream.cpp +++ b/hipamd/src/hip_stream.cpp @@ -515,12 +515,9 @@ hipError_t hipStreamWaitEvent_common(hipStream_t stream, hipEvent_t event, unsig "[hipGraph] current capture node StreamWaitEvent on stream : %p, Event %p", stream, event); hipError_t status = hipSuccess; - if (event == nullptr) { + if (event == nullptr || !hip::isValid(stream)) { return hipErrorInvalidHandle; } - if (!hip::isValid(stream)) { - return hipErrorContextIsDestroyed; - } hip::Stream* waitStream = reinterpret_cast(stream); hip::Event* e = reinterpret_cast(event); hip::Stream* eventStream = reinterpret_cast(e->GetCaptureStream());