diff --git a/Hydrogent/interface/Tasks/HnReadRprimIdTask.hpp b/Hydrogent/interface/Tasks/HnReadRprimIdTask.hpp index 644bebf7..8f07da92 100644 --- a/Hydrogent/interface/Tasks/HnReadRprimIdTask.hpp +++ b/Hydrogent/interface/Tasks/HnReadRprimIdTask.hpp @@ -79,7 +79,7 @@ class HnReadRprimIdTask final : public HnTask static constexpr Uint32 InvalidMeshIndex = ~0u; /// Returns the mesh index that was read from the mesh id target last time the task was executed. - /// If Mesh Id is not available, returns ~0u. + /// If Mesh Id is not available, returns InvalidMeshIndex (~0u). Uint32 GetMeshIndex() const { return m_MeshIndex; } private: diff --git a/Hydrogent/src/Tasks/HnTaskManager.cpp b/Hydrogent/src/Tasks/HnTaskManager.cpp index b1e8c55c..675f383e 100644 --- a/Hydrogent/src/Tasks/HnTaskManager.cpp +++ b/Hydrogent/src/Tasks/HnTaskManager.cpp @@ -304,12 +304,16 @@ const pxr::SdfPath* HnTaskManager::GetSelectedRPrimId() const const Uint32 MeshIdx = ReadRprimIdTask.GetMeshIndex(); if (MeshIdx == HnReadRprimIdTask::InvalidMeshIndex) { - static const pxr::SdfPath EmptyPath; - return &EmptyPath; + // Data is not yet available + return nullptr; } else { - return static_cast(GetRenderIndex().GetRenderDelegate())->GetRPrimId(MeshIdx); + const pxr::SdfPath* rPRimId = static_cast(GetRenderIndex().GetRenderDelegate())->GetRPrimId(MeshIdx); + static const pxr::SdfPath EmptyPath; + return rPRimId != nullptr ? + rPRimId : + &EmptyPath; // Return empty path to indicate that the data is available, but no RPrim is not selected } }