Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 11 additions & 24 deletions UI/Dialogs/Editors/propeditor/ipropeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,22 @@ namespace dialog::editor
1, PROP_TYPE(ulPropTag) == PT_ERROR ? CHANGE_PROP_TYPE(ulPropTag, PT_UNSPECIFIED) : ulPropTag};
ULONG ulValues = NULL;

auto hRes = WC_MAPI(lpMAPIProp->GetProps(&sTag, NULL, &ulValues, &sourceProp));

// Suppress MAPI_E_NOT_FOUND error when the source type is non error
if (sourceProp && PROP_TYPE(sourceProp->ulPropTag) == PT_ERROR &&
sourceProp->Value.err == MAPI_E_NOT_FOUND && PROP_TYPE(ulPropTag) != PT_ERROR)
{
MAPIFreeBuffer(sourceProp);
sourceProp = nullptr;
}
WC_MAPI_S(lpMAPIProp->GetProps(&sTag, NULL, &ulValues, &sourceProp));
lpsPropValue = sourceProp;
}

if (hRes == MAPI_E_CALL_FAILED)
if (lpsPropValue)
{
// Missing values can be created, but other errors must not be read as the requested type.
if (PROP_TYPE(lpsPropValue->ulPropTag) == PT_ERROR && lpsPropValue->Value.err == MAPI_E_NOT_FOUND &&
PROP_TYPE(ulPropTag) != PT_ERROR)
{
// Just suppress this - let the user edit anyway
hRes = S_OK;
lpsPropValue = nullptr;
}

// In all cases where we got a value back, we need to reset our property tag to the value we got
// This will address when the source is PT_UNSPECIFIED, when the returned value is PT_ERROR,
// or any other case where the returned value has a different type than requested
if (SUCCEEDED(hRes) && sourceProp)
else
{
ulPropTag = sourceProp->ulPropTag;
ulPropTag = lpsPropValue->ulPropTag;
}

lpsPropValue = sourceProp;
}
else if (lpsPropValue && PROP_TYPE(lpsPropValue->ulPropTag) != PT_ERROR)
{
ulPropTag = lpsPropValue->ulPropTag;
}

auto propertyEditor = std::shared_ptr<IPropEditor>{};
Expand Down
Loading