diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a76139..bbecef6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,5 +5,6 @@ All notable changes to the "cyezoi" extension will be documented in this file. ## v0.0.34 - Fix grammar mistake +- Fix undefined star Want to see the previous log? [Click here](https://github.com/CYEZOI/cyezoi-helper/commits/main/CHANGELOG.md) diff --git a/src/extension.ts b/src/extension.ts index b06f825..5b23671 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -192,7 +192,7 @@ export const activate = async (context: vscode.ExtensionContext) => { pid = await ensureData(pid?.toString(), 'pid', 'problem ID', vscode.window.activeTextEditor?.document.fileName.match(/\d+/)?.[0]); if (!pid) { return; } try { - const lastState = await new cyezFetch({ path: `/d/problemset/p/${pid}` }).start().then(response => response.json.psdoc.star); + const lastState = await new cyezFetch({ path: `/d/problemset/p/${pid}` }).start().then(response => response.json.psdoc?.star); await new cyezFetch({ path: `/d/problemset/p/${pid}`, body: { diff --git a/src/treeView/pTree.ts b/src/treeView/pTree.ts index ecf4c1f..b64e342 100644 --- a/src/treeView/pTree.ts +++ b/src/treeView/pTree.ts @@ -33,7 +33,7 @@ export default class extends treeView { export class Problem extends vscode.TreeItem { constructor(pdoc: utils.ProblemDoc, psdoc: utils.ProblemStatusDoc, tid?: string) { - super((psdoc && psdoc.star ? "★ " : "") + 'P' + pdoc.docId, (psdoc && psdoc.status ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None)); + super((psdoc?.star ? "★ " : "") + 'P' + pdoc.docId, (psdoc && psdoc.status ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None)); this.id = (tid ? tid + '-' : '') + pdoc.docId; this.contextValue = 'problem'; this.description = pdoc.title;