Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

common: guard against undefined backStack/forwardStack in TabSessionHistory (#9674)

01zulfid49d42b73620
diff --git a/packages/common/src/utils/tab-session-history.ts b/packages/common/src/utils/tab-session-history.ts
index ab85c5568..dd19d5d0f 100644
--- a/packages/common/src/utils/tab-session-history.ts
+++ b/packages/common/src/utils/tab-session-history.ts
@@ -163,13 +163,13 @@ export class TabSessionHistory {
canGoBack(id: string) {
const tabHistory = this.options.get().tabSessionHistory[id];
- if (!tabHistory) return false;
+ if (!tabHistory || !tabHistory.backStack) return false;
return tabHistory.backStack.length > 1;
}
canGoForward(id: string) {
const tabHistory = this.options.get().tabSessionHistory[id];
- if (!tabHistory) return false;
+ if (!tabHistory || !tabHistory.forwardStack) return false;
return tabHistory.forwardStack.length >= 1;
}
}