Skip to content

Commit 8351526

Browse files
authored
Merge pull request #2290 from dpalou/MOBILE-3323
MOBILE-3323 quiz: Fix nativeElement error when submit quiz
2 parents ab944cb + 65a24ed commit 8351526

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/addon/mod/quiz/pages/player/player.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
154154

155155
await this.domUtils.showConfirm(this.translate.instant('addon.mod_quiz.confirmleavequizonerror'));
156156

157-
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
157+
if (this.formElement) {
158+
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
159+
}
158160
} finally {
159161
modal.dismiss();
160162
}
@@ -589,8 +591,10 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
589591
this.autoSave.cancelAutoSave();
590592
this.autoSave.hideAutoSaveError();
591593

592-
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !this.offline,
593-
this.sitesProvider.getCurrentSiteId());
594+
if (this.formElement) {
595+
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !this.offline,
596+
this.sitesProvider.getCurrentSiteId());
597+
}
594598
});
595599
}
596600

0 commit comments

Comments
 (0)