Fix NPE when handling certain kinds of ANRs.

Change-Id: Iccef1852e52c84f6f49d30c491431460a10b33d3
This commit is contained in:
Jeff Brown 2010-09-16 11:02:16 -07:00
parent 30aeb8c854
commit 40ad470643
1 changed files with 6 additions and 4 deletions

View File

@ -777,10 +777,12 @@ void InputDispatcher::resumeAfterTargetsNotReadyTimeoutLocked(nsecs_t newTimeout
mInputTargetWaitTimeoutExpired = true;
// Input state will not be realistic. Mark it out of sync.
ssize_t connectionIndex = getConnectionIndexLocked(inputChannel);
if (connectionIndex >= 0) {
sp<Connection> connection = mConnectionsByReceiveFd.valueAt(connectionIndex);
connection->inputState.setOutOfSync();
if (inputChannel.get()) {
ssize_t connectionIndex = getConnectionIndexLocked(inputChannel);
if (connectionIndex >= 0) {
sp<Connection> connection = mConnectionsByReceiveFd.valueAt(connectionIndex);
connection->inputState.setOutOfSync();
}
}
}
}