common: fix returned value

In the case of requesting to unload a font that
has not been previously loaded, InsufficientCondition
should be returned, not InvalidArgument.
This commit is contained in:
Mira Grudzinska 2024-06-15 14:33:28 +02:00 committed by Hermet Park
parent 596845d1cf
commit 33640eae83
2 changed files with 2 additions and 1 deletions

View file

@ -1637,6 +1637,7 @@ public:
* @retval Result::InvalidArguments If no name is provided or if @p size is zero while @p data points to a valid memory location.
* @retval Result::NonSupport When trying to load a file with an unsupported extension.
* @retval Result::Unknown If an error occurs at a later stage.
* @retval Result::InsufficientCondition If attempting to unload the font data that has not been previously loaded.
*
* @warning: It's the user responsibility to release the @p data memory.
*

View file

@ -78,7 +78,7 @@ Result Text::load(const char* name, const char* data, uint32_t size, const strin
//unload font
if (!data) {
if (LoaderMgr::retrieve(name)) return Result::Success;
return Result::InvalidArguments;
return Result::InsufficientCondition;
}
if (!LoaderMgr::loader(name, data, size, mimeType, copy)) return Result::NonSupport;