From 6e0a2169b17028a1589c948072d0db068eddda67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kn=C3=B6rig?= Date: Mon, 14 Sep 2020 14:56:05 +0200 Subject: [PATCH] Projector Plugin: Fix bookmark loading (issue #4159) Bookmark loading currently fails because of a missing type check. This change makes sure the object that is checked against is actually an HTMLElement. --- .../vz_projector/vz-projector-bookmark-panel.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tensorboard/plugins/projector/vz_projector/vz-projector-bookmark-panel.ts b/tensorboard/plugins/projector/vz_projector/vz-projector-bookmark-panel.ts index a4a2e6b6ed1..70f924fd37d 100644 --- a/tensorboard/plugins/projector/vz_projector/vz-projector-bookmark-panel.ts +++ b/tensorboard/plugins/projector/vz_projector/vz-projector-bookmark-panel.ts @@ -197,9 +197,12 @@ class BookmarkPanel extends LegacyElementMixin(PolymerElement) { */ private getParentDataIndex(evt: Event) { for (let i = 0; i < (evt as any).path.length; i++) { - let dataIndex = (evt as any).path[i].getAttribute('data-index'); - if (dataIndex != null) { - return +dataIndex; + let elem = (evt as any).path[i]; + if (elem instanceof HTMLElement) { + let dataIndex = elem.getAttribute('data-index'); + if (dataIndex != null) { + return +dataIndex; + } } } return -1;