Skip to content

Commit

Permalink
Fix NPE on ServerInfoCard (#1009)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
dvaldivia committed Sep 5, 2021
1 parent 39eeede commit 50c1fe8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -92,7 +93,6 @@ interface ICardProps {
}

const ServerInfoCard = ({ classes, server }: ICardProps) => {
console.log(server);
const serverStatusToClass = (health_status: string) => {
switch (health_status) {
case "offline":
Expand All @@ -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;
Expand Down

0 comments on commit 50c1fe8

Please sign in to comment.