diff --git a/apps/desktop/src/app/tools/send/guards/unsaved-send-edits.guard.ts b/apps/desktop/src/app/tools/send/guards/unsaved-send-edits.guard.ts index 9d064491728..d37f9d86880 100644 --- a/apps/desktop/src/app/tools/send/guards/unsaved-send-edits.guard.ts +++ b/apps/desktop/src/app/tools/send/guards/unsaved-send-edits.guard.ts @@ -3,5 +3,10 @@ import { CanDeactivateFn } from "@angular/router"; import { SendComponent } from "../send.component"; export const unsavedSendEditsGuard: CanDeactivateFn = async (component) => { + // Angular passes null when the component has already been destroyed mid-navigation + // (e.g. during logout teardown). No edits to save in that case — allow the navigation. + if (component == null) { + return true; + } return component.saveUnsavedSendEdits(); }; diff --git a/apps/web/src/app/tools/guards/unsaved-send-edits.guard.ts b/apps/web/src/app/tools/guards/unsaved-send-edits.guard.ts index e146cc4fd35..2c791b346c4 100644 --- a/apps/web/src/app/tools/guards/unsaved-send-edits.guard.ts +++ b/apps/web/src/app/tools/guards/unsaved-send-edits.guard.ts @@ -3,5 +3,10 @@ import { CanDeactivateFn } from "@angular/router"; import { SendComponent } from "../send/send.component"; export const unsavedSendEditsGuard: CanDeactivateFn = async (component) => { + // Angular passes null when the component has already been destroyed mid-navigation + // (e.g. during logout teardown). No edits to save in that case — allow the navigation. + if (component == null) { + return true; + } return component.saveUnsavedSendEdits(); };