From 8e5afb5bbb47324a381b5184254e77eba7bd8536 Mon Sep 17 00:00:00 2001
From: Fawn <fangrui_tong@brown.edu>
Date: Tue, 18 Jun 2019 16:30:24 -0400
Subject: can click on button link to node in different context than source

---
 .../collections/collectionFreeForm/CollectionFreeFormLinksView.tsx  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormLinksView.tsx')

diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinksView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinksView.tsx
index fc92c81d5..86625863f 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinksView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormLinksView.tsx
@@ -190,12 +190,12 @@ export class CollectionFreeFormLinksView extends React.Component<CollectionViewP
         return unique.map(u => {
             // TODO: make better key
             let key = StrCast(u.sourceView.Document[Id]) + "-link-" + StrCast(u.targetView.Document[Id]) + "-" + Date.now() + Math.random();
-            let sourceIn = u.sourceView.props.ContainingCollectionView!.props.Document === this.props.Document;
-            let targetIn = u.targetView.props.ContainingCollectionView!.props.Document === this.props.Document;
+            let sourceIn = u.sourceView.props.ContainingCollectionView ? u.sourceView.props.ContainingCollectionView.props.Document === this.props.Document : false;
+            let targetIn = u.targetView.props.ContainingCollectionView ? u.targetView.props.ContainingCollectionView.props.Document === this.props.Document : false;
             let inContainer = u.sameContext ? sourceIn || targetIn : sourceIn;
             if (inContainer) {
                 // console.log("key", key, StrCast(u.sourceView.Document.title), StrCast(u.targetView.Document.title));
-                return <CollectionFreeFormLinkView key={key} sourceView={u.sourceView} targetView={u.targetView} sameContext={u.sameContext} />;
+                return <CollectionFreeFormLinkView key={key} sourceView={u.sourceView} targetView={u.targetView} sameContext={u.sameContext} addDocTab={this.props.addDocTab} />;
             } else {
                 return <div key={key}></div>;
             }
-- 
cgit v1.2.3-70-g09d2

