From 2f04eb90d37fac1269b9a7a19745914a3bda4f07 Mon Sep 17 00:00:00 2001 From: German Andryeyev Date: Mon, 16 May 2022 09:41:47 -0400 Subject: [PATCH] SWDEV-336024 - Add a check for nullptr in HeapBuffer() Change-Id: Ib8a3f2757c8600c4bd5bed417b230a60d4cf3d42 --- rocclr/device/device.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rocclr/device/device.hpp b/rocclr/device/device.hpp index 5f319c0852..9fab651d24 100644 --- a/rocclr/device/device.hpp +++ b/rocclr/device/device.hpp @@ -1899,7 +1899,9 @@ class Device : public RuntimeObject { Memory* P2PStage() const { return p2p_stage_; } //! Returns heap buffer object for device allocator - device::Memory* HeapBuffer() const { return heap_buffer_->getDeviceMemory(*this); } + device::Memory* HeapBuffer() const { + return (heap_buffer_ != nullptr) ? heap_buffer_->getDeviceMemory(*this) : nullptr; + } //! Does this device allow P2P access? bool P2PAccessAllowed() const { return (p2p_access_devices_.size() > 0) ? true : false; }