fix: a null point exception

This commit is contained in:
Zhicheng Wang 2017-08-21 09:05:59 +08:00
parent de34171fa2
commit 0e1fa4581a
1 changed files with 1 additions and 1 deletions

View File

@ -139,7 +139,7 @@ export class DocViewerComponent implements DoCheck, OnDestroy {
@HostListener('click', ['$event'])
toggleTranslationOrigin($event: MouseEvent): void {
const element = findTranslationResult($event.target as Element);
if (element.hasAttribute('translation-result')) {
if (element && element.hasAttribute('translation-result')) {
const origin = element.nextElementSibling;
if (!origin || origin.hasAttribute('translation-result') || origin.tagName !== element.tagName) {
return;