From 063097545e6a273952463803d1a2fab2cb590d4e Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Thu, 11 Aug 2011 17:10:06 -0700 Subject: Ensure outValue is set, even when an error occurs. Change-Id: If883f60cde28792bd0e108597ced49d69d13136e --- services/input/EventHub.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index 960e4143e659..1d7cc19c02b8 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -312,6 +312,8 @@ int32_t EventHub::getSwitchState(int32_t deviceId, int32_t sw) const { } status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const { + *outValue = 0; + if (axis >= 0 && axis <= ABS_MAX) { AutoMutex _l(mLock); @@ -328,7 +330,6 @@ status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* return OK; } } - *outValue = 0; return -1; } -- cgit v1.2.3-59-g8ed1b