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

Commit c7bad6ed authored by Siarhei Vishniakou's avatar Siarhei Vishniakou Committed by android-build-merger
Browse files

Ensure history has pointer id of interest. am: c7dc3784

am: 2d46ae78

Change-Id: I0f8eec4ae2c4b37bfb0268f0f3c1822c496461ce
parents e04a8005 2d46ae78
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -384,6 +384,10 @@ private:
        const PointerCoords& getPointerById(uint32_t id) const {
            return pointers[idToIndex[id]];
        }

        bool hasPointerId(uint32_t id) const {
            return idBits.hasBit(id);
        }
    };
    struct TouchState {
        int32_t deviceId;
@@ -419,6 +423,9 @@ private:
            if (historySize < 2) {
                return false;
            }
            if (!getHistory(0)->hasPointerId(id) || !getHistory(1)->hasPointerId(id)) {
                return false;
            }
            float currentX = getHistory(0)->getPointerById(id).getX();
            float currentY = getHistory(0)->getPointerById(id).getY();
            float previousX = getHistory(1)->getPointerById(id).getX();