From 8e965db9714d2e193d09f17248ea60f5934ecaa2 Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Thu, 31 Oct 2013 15:15:30 -0700 Subject: [PATCH] make sure we don't shut uiautomator down if it's already gone (fix #1402) --- lib/devices/android/android.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/devices/android/android.js b/lib/devices/android/android.js index 93b8fb522..784a25ad4 100644 --- a/lib/devices/android/android.js +++ b/lib/devices/android/android.js @@ -273,10 +273,15 @@ Android.prototype.cleanup = function() { Android.prototype.shutdown = function(cb) { var next = function() { - this.uiautomator.shutdown(function() { + if (this.uiautomator) { + this.uiautomator.shutdown(function() { + this.cleanup(); + cb(); + }.bind(this)); + } else { this.cleanup(); cb(); - }.bind(this)); + } }.bind(this); if (this.adb) {