diff --git a/UI/Dialogs/Editors/propeditor/ipropeditor.cpp b/UI/Dialogs/Editors/propeditor/ipropeditor.cpp index 94d0d64fc..7b95f4720 100644 --- a/UI/Dialogs/Editors/propeditor/ipropeditor.cpp +++ b/UI/Dialogs/Editors/propeditor/ipropeditor.cpp @@ -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{};