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

Unified Diff: remoting/webapp/base/js/connection_stats.js

Issue 1951633002: Guard against undefined average in stats display. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 8 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: remoting/webapp/base/js/connection_stats.js
diff --git a/remoting/webapp/base/js/connection_stats.js b/remoting/webapp/base/js/connection_stats.js
index 61d5680c6d2748bb3c9d06e1254b438df4396a52..9d163663d380abf25cc7614c82c3fc498417d96e 100644
--- a/remoting/webapp/base/js/connection_stats.js
+++ b/remoting/webapp/base/js/connection_stats.js
@@ -141,7 +141,8 @@ remoting.ConnectionStats.prototype.update = function(stats) {
* @return {string} "type: avg, max; " e.g. "RTT: 8.0, 13; "
*/
function formatStat(type, avg, max) {
- return type + ': ' + avg.toFixed(1) + ', ' + max + '; ';
+ var avgStr = (avg == undefined) ? 'n/a' : avg.toFixed(1);
+ return type + ': ' + avgStr + ', ' + max + '; ';
}
var statistics = document.getElementById('statistics');
« 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