diff options
author | bob <bcz@cs.brown.edu> | 2019-12-16 10:58:54 -0500 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-12-16 10:58:54 -0500 |
commit | 5495d74f7dd02c7204e5cdf2a3d001ac69ae622f (patch) | |
tree | 865a2ef50b4f7e9cfa83b7b6ab14420fbe8d3f2a /src | |
parent | 5241b4e7772b5caa10139c845eb6bc91f8827a12 (diff) |
fixing exceptions
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/DocumentButtonBar.tsx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/views/DocumentButtonBar.tsx b/src/client/views/DocumentButtonBar.tsx index 58728ab7f..8916d4a53 100644 --- a/src/client/views/DocumentButtonBar.tsx +++ b/src/client/views/DocumentButtonBar.tsx @@ -215,9 +215,10 @@ export class DocumentButtonBar extends React.Component<{ views: DocumentView[], } render() { + if (!this.props.views.length) return (null); const templates: Map<Template, boolean> = new Map(); Array.from(Object.values(Templates.TemplateList)).map(template => - templates.set(template, this.props.views.reduce((checked, doc) => checked || doc.getLayoutPropStr("show" + template.Name) ? true : false, false as boolean))); + templates.set(template, this.props.views.reduce((checked, doc) => checked || doc?.getLayoutPropStr("show" + template.Name) ? true : false, false as boolean))); const isText = this.props.views[0].props.Document.data instanceof RichTextField; // bcz: Todo - can't assume layout is using the 'data' field. need to add fieldKey to DocumentView const considerPull = isText && this.considerGoogleDocsPull; |