]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: handle null in format_number 17991/head
authorJohn Spray <john.spray@redhat.com>
Wed, 27 Sep 2017 13:33:58 +0000 (14:33 +0100)
committerJohn Spray <john.spray@redhat.com>
Wed, 27 Sep 2017 13:33:58 +0000 (14:33 +0100)
Fixes: http://tracker.ceph.com/issues/21570
Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/mgr/dashboard/base.html

index 2f7b020c8a868253db252d1340a005acab3601d3..0c0a971f36e866e5e0c90294d88c040d1a15cef8 100644 (file)
                 var width=4;
                 var unit = 0;
 
+                if (n == null) {
+                    // People shouldn't really be passing null, but let's
+                    // do something sensible instead of barfing.
+                    return "-";
+                }
+
                 while (Math.floor(n / (divisor**unit)).toString().length > width - 1) {
                     unit = unit + 1;
                 }