aboutsummaryrefslogtreecommitdiff
path: root/src/client/DocServer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r--src/client/DocServer.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index 5fdea131b..fc8a9f3d6 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -32,9 +32,11 @@ export namespace DocServer {
let _cache: { [id: string]: RefField | Promise<Opt<RefField>> } = {};
export function FindDocByTitle(title: string) {
- const foundDocId = Array.from(Object.keys(_cache))
- .filter(key => _cache[key] instanceof Doc)
- .find(key => (_cache[key] as Doc).title === title);
+ const foundDocId =
+ title &&
+ Array.from(Object.keys(_cache))
+ .filter(key => _cache[key] instanceof Doc)
+ .find(key => (_cache[key] as Doc).title === title);
return foundDocId ? (_cache[foundDocId] as Doc) : undefined;
}