EtheaDev / SVGIconImageList

Three engines to render SVG (Delphi Image32, Skia4Delphi, Direct2D wrapper) and four components to simplify use of SVG images (resize, fixedcolor, grayscale...)
Apache License 2.0
321 stars 93 forks source link

Check for valid imageindex on GetInheriteFixedColor #152

Closed amancini closed 3 years ago

amancini commented 3 years ago

Hello ,

i have add check for correct imageIndex value assigned on function

function TSVGIconImage.GetInheritedFixedColor: TColor;
begin
  Result := SVG_INHERIT_COLOR;
  if not Assigned(FImageList) then Exit;

  if FImageList is TSVGIconImageListBase then
  begin
    if FImageIndex >= 0 then
    begin
      if FImageIndex < TSVGIconImageListBase(FImageList).SVGIconItems.Count -1  then
        Result := TSVGIconImageListBase(FImageList).SVGIconItems[FImageIndex].FixedColor;

      if Result <> SVG_INHERIT_COLOR  then exit;
    end;

    Result := TSVGIconImageListBase(FImageList).FixedColor;
  end;
end;

best regards

carloBarazzetta commented 3 years ago

Fixed in 2.2.2 version