diff --git a/sycl/source/detail/graph_impl.hpp b/sycl/source/detail/graph_impl.hpp index 8cc1e75204697..9d8604316e8d5 100644 --- a/sycl/source/detail/graph_impl.hpp +++ b/sycl/source/detail/graph_impl.hpp @@ -899,7 +899,7 @@ class graph_impl { void addEventForNode(std::shared_ptr GraphImpl, std::shared_ptr EventImpl, std::shared_ptr NodeImpl) { - if (!(EventImpl->getCommandGraph())) + if (EventImpl && !(EventImpl->getCommandGraph())) EventImpl->setCommandGraph(GraphImpl); MEventsMap[EventImpl] = NodeImpl; }