windingwind / zotero-plugin-toolkit

Toolkit for Zotero Plugin Developers.
https://www.npmjs.com/package/zotero-plugin-toolkit
MIT License
104 stars 13 forks source link

[BUG] `window` can be `null` when calling `Zotero.getMainWindow()` #57

Closed ChenglongMa closed 1 month ago

ChenglongMa commented 1 month ago

https://github.com/windingwind/zotero-plugin-toolkit/blob/a6a90697788a10a3f11e22372dceef7ba076cf70/src/basic.ts#L120-L130

L129 may return null when the main window has been unloaded.

It will cause a Type Error in the invoker, e.g., ztoolkit.log().

windingwind commented 1 month ago

Thanks for the feedback.