aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-07-31 11:48:29 -0400
committerbob <bcz@cs.brown.edu>2019-07-31 11:48:29 -0400
commita75f6fb17a4cbb4643cff0d347eb812138957c95 (patch)
treea8769a3f3d7a1ca4a48a2bbfbe32ee3d246627a8 /src/new_fields/Doc.ts
parent1e50488861a1fbadea399bd529b8d51053a3d9b4 (diff)
fixed some css and creating text links.
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index 5f9df786e..84b8589dd 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -197,8 +197,12 @@ export namespace Doc {
}
export function Get(doc: Doc, key: string, ignoreProto: boolean = false): FieldResult {
- const self = doc[Self];
- return getField(self, key, ignoreProto);
+ try {
+ const self = doc[Self];
+ return getField(self, key, ignoreProto);
+ } catch {
+ return doc;
+ }
}
export function GetT<T extends Field>(doc: Doc, key: string, ctor: ToConstructor<T>, ignoreProto: boolean = false): FieldResult<T> {
return Cast(Get(doc, key, ignoreProto), ctor) as FieldResult<T>;