mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 16:36:31 +00:00
Handle NULL being passed to SetPrivateData/SetName
This commit is contained in:
@@ -182,7 +182,7 @@ template <class T>
|
||||
inline void SetDebugName(T *pObj, const char *name)
|
||||
{
|
||||
if(pObj)
|
||||
pObj->SetPrivateData(WKPDID_D3DDebugObjectName, (UINT)strlen(name), name);
|
||||
pObj->SetPrivateData(WKPDID_D3DDebugObjectName, name ? (UINT)strlen(name) : 0, name);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
|
||||
@@ -2224,7 +2224,7 @@ bool WrappedID3D11Device::Serialise_SetResourceName(SerialiserType &ser,
|
||||
{
|
||||
ResourceDescription &descr = GetReplay()->GetResourceDesc(
|
||||
GetResourceManager()->GetOriginalID(GetIDForResource(pResource)));
|
||||
descr.SetCustomName(Name);
|
||||
descr.SetCustomName(Name ? Name : "");
|
||||
AddResourceCurChunk(descr);
|
||||
|
||||
SetDebugName(pResource, Name);
|
||||
|
||||
@@ -1945,13 +1945,13 @@ bool WrappedID3D12Device::Serialise_SetName(SerialiserType &ser, ID3D12DeviceChi
|
||||
if(IsReplayingAndReading() && pResource)
|
||||
{
|
||||
ResourceId origId = GetResourceManager()->GetOriginalID(GetResID(pResource));
|
||||
m_ResourceNames[origId] = Name;
|
||||
m_ResourceNames[origId] = Name ? Name : "";
|
||||
|
||||
ResourceDescription &descr = GetReplay()->GetResourceDesc(origId);
|
||||
descr.SetCustomName(Name);
|
||||
descr.SetCustomName(Name ? Name : "");
|
||||
AddResourceCurChunk(descr);
|
||||
|
||||
pResource->SetName(StringFormat::UTF82Wide(Name).c_str());
|
||||
pResource->SetName(StringFormat::UTF82Wide(Name ? Name : "").c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -288,7 +288,7 @@ public:
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetName(LPCWSTR Name)
|
||||
{
|
||||
string utf8 = StringFormat::Wide2UTF8(Name);
|
||||
string utf8 = Name ? StringFormat::Wide2UTF8(Name) : "";
|
||||
m_pDevice->SetName(this, utf8.c_str());
|
||||
|
||||
if(!m_pReal)
|
||||
|
||||
Reference in New Issue
Block a user