Fixed UwacDisplayGetOutput and UwacOutputGetResolution checks
return proper error conditions if arguments are invalid.
This commit is contained in:
parent
5ce0ab909f
commit
9900e52073
@ -668,12 +668,16 @@ uint32_t UwacDisplayGetNbOutputs(const UwacDisplay* display)
|
||||
|
||||
const UwacOutput* UwacDisplayGetOutput(UwacDisplay* display, int index)
|
||||
{
|
||||
int i;
|
||||
int i, display_count;
|
||||
UwacOutput* ret = NULL;
|
||||
|
||||
if (!display)
|
||||
return NULL;
|
||||
|
||||
display_count = wl_list_length(&display->outputs);
|
||||
if (display_count <= index)
|
||||
return NULL;
|
||||
|
||||
i = 0;
|
||||
wl_list_for_each(ret, &display->outputs, link)
|
||||
{
|
||||
@ -694,6 +698,9 @@ const UwacOutput* UwacDisplayGetOutput(UwacDisplay* display, int index)
|
||||
|
||||
UwacReturnCode UwacOutputGetResolution(const UwacOutput* output, UwacSize* resolution)
|
||||
{
|
||||
if ((output->resolution.height <= 0) || (output->resolution.width <= 0))
|
||||
return UWAC_ERROR_INTERNAL;
|
||||
|
||||
*resolution = output->resolution;
|
||||
return UWAC_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user