mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 11:33:41 +03:00
link: additional safety checks in settings view
This commit is contained in:
parent
7febf927fa
commit
ee887caced
@ -27,7 +27,7 @@ export class SettingsScreen extends Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (this.props.resource) {
|
||||
if ((this.props.resource) && ("metadata" in this.props.resource)) {
|
||||
this.setState({
|
||||
title: this.props.resource.metadata.title,
|
||||
description: this.props.resource.metadata.description,
|
||||
@ -47,7 +47,8 @@ export class SettingsScreen extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
if (props.resource && (prevProps !== props)) {
|
||||
if (((this.props.resource) && ("metadata" in this.props.resource))
|
||||
&& (prevProps !== props)) {
|
||||
this.setState({
|
||||
title: props.resource.metadata.title,
|
||||
description: props.resource.metadata.description,
|
||||
@ -107,6 +108,10 @@ export class SettingsScreen extends Component {
|
||||
const { props, state } = this;
|
||||
const { resource } = props;
|
||||
|
||||
if (!("metadata" in resource)) {
|
||||
resource.metadata = {};
|
||||
}
|
||||
|
||||
return(
|
||||
<div>
|
||||
<div className={"w-100 pb6 fl mt3 " + ((props.amOwner) ? '' : 'o-30')}>
|
||||
|
Loading…
Reference in New Issue
Block a user