windingwind / zotero-plugin-toolkit

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

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

Closed ChenglongMa closed 3 months ago

ChenglongMa commented 3 months 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 3 months ago

Thanks for the feedback.