commit 9146fb03d9a94e7fd6fb08fdb54a4926c7976dcf
parent 9c3ec6f0beeda9cb743334d13af0d5b319df3dc5
Author: Simon Kornblith <simon@simonster.com>
Date: Mon, 1 Sep 2014 23:18:39 -0400
Merge pull request #536 from adam3smith/coinsfix
test for presence of author's firstName before using it
Diffstat:
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/chrome/content/zotero/xpcom/openurl.js b/chrome/content/zotero/xpcom/openurl.js
@@ -478,17 +478,18 @@ Zotero.OpenURL = new function() {
var pushMe = true;
var offset = complexAu[i].offset;
delete complexAu[i].offset;
- for(var j=0; j<item.creators.length; j++) {
- // if there's a plain author that is close to this author (the
- // same last name, and the same first name up to a point), keep
- // the plain author, since it might have a middle initial
- if(item.creators[j].lastName == complexAu[i].lastName &&
- (item.creators[j].firstName == complexAu[i].firstName == "" ||
- (item.creators[j].firstName.length >= complexAu[i].firstName.length &&
- item.creators[j].firstName.substr(0, complexAu[i].firstName.length) == complexAu[i].firstName))) {
- pushMe = false;
- break;
- }
+ for (var j = 0; j < item.creators.length; j++) {
+ // if there's a plain author that is close to this author (the
+ // same last name, and the same first name up to a point), keep
+ // the plain author, since it might have a middle initial
+ if (item.creators[j].lastName == complexAu[i].lastName &&
+ item.creators[j].firstName &&
+ (item.creators[j].firstName == complexAu[i].firstName == "" ||
+ (item.creators[j].firstName.length >= complexAu[i].firstName.length &&
+ item.creators[j].firstName.substr(0, complexAu[i].firstName.length) == complexAu[i].firstName))) {
+ pushMe = false;
+ break;
+ }
}
// Splice in the complex creator at the correct location,
// accounting for previous insertions