]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: handle null in format_number 18728/head
authorJohn Spray <john.spray@redhat.com>
Wed, 27 Sep 2017 13:33:58 +0000 (14:33 +0100)
committerShinobu Kinjo <shinobu@redhat.com>
Sat, 4 Nov 2017 09:13:12 +0000 (18:13 +0900)
Fixes: http://tracker.ceph.com/issues/21570
Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit f43859d4dca696ba4cac224e0c7e87e4b2aad40f)

src/pybind/mgr/dashboard/base.html

index 146bd92d0c807a2d7aaa7fd06b60ac42288b3e02..d3783873c20461b713bf6140fbf49fde556ab0d3 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;
                 }