Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5317430 authored by Fedor Kudasov's avatar Fedor Kudasov
Browse files

Fix potential off-by-one

Being consistent with the notion of mEndChildIndex, it should be -1 by
default. Otherwise it assumes the display list has a single element.
This is consistent with EndReorderBarrierDrawable constructor that would
set mEndChildIndex to -1 if display list is empty.

Bug: 117921091
Test: all tests should pass
Change-Id: I64b84c789ad8126ac8f0b8c2ebfc128635e5b30d
parent 3d9b8679
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ namespace uirenderer {
namespace skiapipeline {

StartReorderBarrierDrawable::StartReorderBarrierDrawable(SkiaDisplayList* data)
        : mEndChildIndex(0), mBeginChildIndex(data->mChildNodes.size()), mDisplayList(data) {}
        : mEndChildIndex(-1), mBeginChildIndex(data->mChildNodes.size()), mDisplayList(data) {}

void StartReorderBarrierDrawable::onDraw(SkCanvas* canvas) {
    if (mChildren.empty()) {