diff --git a/chrome/content/zotfile/zotfile.js b/chrome/content/zotfile/zotfile.js index f4fef586..9e5a3b1c 100644 --- a/chrome/content/zotfile/zotfile.js +++ b/chrome/content/zotfile/zotfile.js @@ -1382,10 +1382,13 @@ Zotero.ZotFile = { author_lastg = author_lastg + this.prefs.getCharPref("etal"); } //create last (senior) author string - var lastAuthor = creators[creators.length - 1].ref.lastName; - var lastAuthor_lastf = creators[creators.length - 1].ref.lastName + creators[creators.length - 1].ref.firstName.substr(0, 1).toUpperCase(); - var lastAuthor_initials = creators[creators.length - 1].ref.firstName.substr(0, 1).toUpperCase() + creators[creators.length - 1].ref.lastName.substr(0, 1).toUpperCase(); - var lastAuthor_lastInitial = creators[creators.length - 1].ref.lastName.substr(0, 1).toUpperCase(); + var lastAuthor = "", lastAuthor_lastf= "", lastAuthor_initials= "", lastAuthor_lastInitial = ""; + if (creators.length > 0) { + lastAuthor = creators[creators.length - 1].ref.lastName; + lastAuthor_lastf = creators[creators.length - 1].ref.lastName + creators[creators.length - 1].ref.firstName.substr(0, 1).toUpperCase(); + lastAuthor_initials = creators[creators.length - 1].ref.firstName.substr(0, 1).toUpperCase() + creators[creators.length - 1].ref.lastName.substr(0, 1).toUpperCase(); + lastAuthor_lastInitial = creators[creators.length - 1].ref.lastName.substr(0, 1).toUpperCase(); + } // get creator and create editors string var editorType = [3,4,5,27,29]; var editor = "", editor_lastf="", editor_initials=""; diff --git a/readme.md b/readme.md index 2ba52c0b..c8f59529 100644 --- a/readme.md +++ b/readme.md @@ -34,6 +34,10 @@ Contributions preferably through pull requests are welcome! ## Changelog +#### Changes in 4.2.1 + +- Fix: Renaming attachments without author failed + #### Changes in 4.2 - Add wildcard %g for author's full name (thanks to [QingQYang](https://github.com/QingQYang))