diff --git a/src/components/home/TrafficNow.tsx b/src/components/home/TrafficNow.tsx index 0de93488f..61efc0a29 100644 --- a/src/components/home/TrafficNow.tsx +++ b/src/components/home/TrafficNow.tsx @@ -37,14 +37,18 @@ function TrafficNow({ apiConfig }) {
{t('Download Total')}
{dlTotal}
-
-
{t('Proxy Upload Total')}
-
{proxyUpTotal}
-
-
-
{t('Proxy Download Total')}
-
{proxyDlTotal}
-
+ {proxyUpTotal ? +
+
{t('Proxy Upload Total')}
+
{proxyUpTotal}
+
: null + } + {proxyDlTotal ? +
+
{t('Proxy Download Total')}
+
{proxyDlTotal}
+
: null + }
{t('Active Connections')}
{connNumber}
diff --git a/src/misc/pretty-bytes.ts b/src/misc/pretty-bytes.ts index 68b67769a..2d8f07794 100644 --- a/src/misc/pretty-bytes.ts +++ b/src/misc/pretty-bytes.ts @@ -3,6 +3,9 @@ const UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; export default function prettyBytes(n: number) { + if (n === null || n === undefined || isNaN(n)) { + return '0 B'; + } if (n < 1000) { return n + ' B'; }