Merge pull request #3124 from nathankidd/region16_rects-handle-null

libfreerdp-codec: Make region16_rects() handle NULL nbRects
This commit is contained in:
Hardening 2016-02-12 21:19:13 +01:00
commit ef7c867f43
2 changed files with 6 additions and 6 deletions

View File

@ -73,10 +73,10 @@ FREERDP_API void region16_init(REGION16 *region);
/** @return the number of rectangles of this region16 */
FREERDP_API int region16_n_rects(const REGION16 *region);
/** returns a pointer on rectangles and the number of rectangles in this region.
* nbRect can be set to NULL if not interested by the numnber of rectangles.
/** returns a pointer to rectangles and the number of rectangles in this region.
* nbRects can be set to NULL if not interested in the number of rectangles.
* @param region the input region
* @param nbRects a pointer that will be filled with the number of rectangles
* @param nbRects if non-NULL returns the number of rectangles
* @return a pointer on the rectangles
*/
FREERDP_API const RECTANGLE_16 *region16_rects(const REGION16 *region, int *nbRects);

View File

@ -94,17 +94,17 @@ const RECTANGLE_16 *region16_rects(const REGION16 *region, int *nbRects)
REGION16_DATA *data;
assert(region);
assert(region->data);
data = region->data;
if (!data)
{
if (nbRects)
*nbRects = 0;
return 0;
return NULL;
}
*nbRects = data->nbRects;
if (nbRects)
*nbRects = data->nbRects;
return (RECTANGLE_16 *)(data + 1);
}