vatmeta: fixing potential null ref

This commit is contained in:
Hunter Miller 2021-09-27 10:35:37 -05:00
parent 934c32d401
commit 641975ba39

View File

@ -8,8 +8,8 @@ export function VatMeta(props: { vat: Vat }) {
const { vat } = props; const { vat } = props;
const { desk, arak, cass, hash } = vat; const { desk, arak, cass, hash } = vat;
const { desk: foreignDesk, ship, next } = arak.rail!; const { desk: foreignDesk, ship, next } = arak.rail || {};
const pluralUpdates = next.length !== 1; const pluralUpdates = next?.length !== 1;
return ( return (
<div className="mt-5 sm:mt-8 space-y-5 sm:space-y-8"> <div className="mt-5 sm:mt-8 space-y-5 sm:space-y-8">
<Attribute title="Developer Desk" attr="desk"> <Attribute title="Developer Desk" attr="desk">
@ -24,7 +24,7 @@ export function VatMeta(props: { vat: Vat }) {
<Attribute title="Installed into" attr="local-desk"> <Attribute title="Installed into" attr="local-desk">
%{desk} %{desk}
</Attribute> </Attribute>
{next.length > 0 ? ( {next && next.length > 0 ? (
<Attribute attr="next" title="Pending Updates"> <Attribute attr="next" title="Pending Updates">
{next.length} update{pluralUpdates ? 's are' : ' is'} pending a System Update {next.length} update{pluralUpdates ? 's are' : ' is'} pending a System Update
</Attribute> </Attribute>