Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: telemetry/telemetry/internal/platform/android_platform_backend.py

Issue 2419023003: [Android] Check list length before printing forwarder information. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: telemetry/telemetry/internal/platform/android_platform_backend.py
diff --git a/telemetry/telemetry/internal/platform/android_platform_backend.py b/telemetry/telemetry/internal/platform/android_platform_backend.py
index 3b57f66779275d245392320e15b66ce60fb323f7..b625bfee29005bf635499940af4109a4d11022c6 100644
--- a/telemetry/telemetry/internal/platform/android_platform_backend.py
+++ b/telemetry/telemetry/internal/platform/android_platform_backend.py
@@ -484,9 +484,13 @@ class AndroidPlatformBackend(
def StopForwardingHost(self, host_port):
for line in self._device.adb.ForwardList().strip().splitlines():
line = line.split(' ')
- if line[0] == self._device and line[1] == 'tcp:%s' % host_port:
- self._device.adb.ForwardRemove('tcp:%d' % host_port)
- break
+ if len(line) >= 2:
+ if line[0] == self._device and line[1] == 'tcp:%s' % host_port:
+ self._device.adb.ForwardRemove('tcp:%d' % host_port)
+ break
+ else:
+ logging.warning('Attempted to split line in StopForwardingHost method, '
+ 'but outcome was unexpected:\n%s' % line)
mikecase (-- gone --) 2016/10/14 16:58:13 nit: I would reword this error message to somethin
rnephew (Reviews Here) 2016/10/14 17:06:41 Done.
else:
logging.warning('Port %s not found in adb forward --list for device %s',
host_port, self._device)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698