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:
parent
6ec818fc11
commit
a2bbafff3f
|
|
@ -80,7 +80,7 @@ export class SaveManager {
|
||||||
if (this.isSaving) return;
|
if (this.isSaving) return;
|
||||||
if (!this.hasPendingSave) return;
|
if (!this.hasPendingSave) return;
|
||||||
|
|
||||||
const activeProject = this.editor.project.getActive();
|
const activeProject = this.editor.project.getActiveOrNull();
|
||||||
if (!activeProject) return;
|
if (!activeProject) return;
|
||||||
if (this.editor.project.getIsLoading()) return;
|
if (this.editor.project.getIsLoading()) return;
|
||||||
if (this.editor.project.getMigrationState().isMigrating) return;
|
if (this.editor.project.getMigrationState().isMigrating) return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue