Index: remoting/webapp/host_list.js |
diff --git a/remoting/webapp/host_list.js b/remoting/webapp/host_list.js |
index c3d2d23d14cd3dfd3bc1e54da3f2f7acfa00016f..05f03735550371092fa289eaa2d9f8779faf25c1 100644 |
--- a/remoting/webapp/host_list.js |
+++ b/remoting/webapp/host_list.js |
@@ -116,11 +116,10 @@ remoting.HostList.prototype.refresh = function(onDone) { |
}; |
/** @param {remoting.Error} error */ |
var onError = function(error) { |
+ that.hosts_ = []; |
that.lastError_ = error; |
onDone(false); |
}; |
- this.hosts_ = []; |
- this.lastError_ = ''; |
remoting.oauth2.callWithToken(getHosts, onError); |
}; |
@@ -135,6 +134,8 @@ remoting.HostList.prototype.refresh = function(onDone) { |
* @private |
*/ |
remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) { |
+ this.hosts_ = []; |
+ this.lastError_ = ''; |
try { |
if (xhr.status == 200) { |
var response = |
@@ -155,10 +156,9 @@ remoting.HostList.prototype.parseHostListResponse_ = function(onDone, xhr) { |
return 0; |
}; |
this.hosts_ = /** @type {Array} */ this.hosts_.sort(cmp); |
- } else { |
- this.hosts_ = []; |
} |
} else { |
+ this.lastError_ = remoting.Error.UNEXPECTED; |
console.error('Invalid "hosts" response from server.'); |
} |
} else { |