Ensure history has pointer id of interest.
am: c7dc3784a3
Change-Id: I810a5f46a324aa9592418355e5d9838af8875622
diff --git a/include/input/InputTransport.h b/include/input/InputTransport.h
index 0dd15b1..9449474 100644
--- a/include/input/InputTransport.h
+++ b/include/input/InputTransport.h
@@ -384,6 +384,10 @@
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 @@
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();