From 50c1fe8298c31ed4639a6e3a9ea5ffb8b80d7850 Mon Sep 17 00:00:00 2001 From: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> Date: Sat, 4 Sep 2021 21:37:53 -0700 Subject: [PATCH] Fix NPE on ServerInfoCard (#1009) * Fix NPE on ServerInfoCard Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> * missing import Signed-off-by: Daniel Valdivia <18384552+dvaldivia@users.noreply.github.com> --- .../Console/Dashboard/BasicDashboard/ServerInfoCard.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx b/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx index b980d35ba..bb3053adf 100644 --- a/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx +++ b/portal-ui/src/screens/Console/Dashboard/BasicDashboard/ServerInfoCard.tsx @@ -22,6 +22,7 @@ import { ServerInfo } from "../types"; import { niceDays } from "../../../../common/utils"; import { Card, CardHeader } from "@material-ui/core"; import { CircleIcon } from "../../../../icons"; +import get from "lodash/get"; const styles = (theme: Theme) => createStyles({ @@ -92,7 +93,6 @@ interface ICardProps { } const ServerInfoCard = ({ classes, server }: ICardProps) => { - console.log(server); const serverStatusToClass = (health_status: string) => { switch (health_status) { case "offline": @@ -104,7 +104,7 @@ const ServerInfoCard = ({ classes, server }: ICardProps) => { } }; - const networkKeys = Object.keys(server.network); + const networkKeys = Object.keys(get(server, "network", [])); const networkTotal = networkKeys.length; const totalDrives = server.drives.length;