fix(SaveManager): use getActiveOrNull to avoid race when leaving editor

When closeProject() sets this.active = null, a debounced save scheduled before
  may still fire, causing getActive() to throw "No active project". The existing
  `if (!activeProject) return;` guard was dead code. Switching to getActiveOrNull
  makes the guard actually work.
    - 选 ⊙ Create a new branch for
This commit is contained in:
gewu2022 2026-04-27 15:55:53 +08:00 committed by GitHub
parent 6ec818fc11
commit a2bbafff3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -80,7 +80,7 @@ export class SaveManager {
if (this.isSaving) return;
if (!this.hasPendingSave) return;
const activeProject = this.editor.project.getActive();
const activeProject = this.editor.project.getActiveOrNull();
if (!activeProject) return;
if (this.editor.project.getIsLoading()) return;
if (this.editor.project.getMigrationState().isMigrating) return;