Fix startup hang if note is null in database
This commit is contained in:
parent
ca9a7c685e
commit
2194dff7a4
1 changed files with 24 additions and 14 deletions
|
@ -415,6 +415,10 @@ Zotero.Items = function() {
|
|||
|
||||
// Convert non-HTML notes on-the-fly
|
||||
if (note !== "") {
|
||||
if (typeof note == 'number') {
|
||||
note = '' + note;
|
||||
}
|
||||
if (typeof note == 'string') {
|
||||
if (!note.substr(0, 36).match(/^<div class="zotero-note znv[0-9]+">/)) {
|
||||
note = Zotero.Utilities.htmlSpecialChars(note);
|
||||
note = Zotero.Notes.notePrefix + '<p>'
|
||||
|
@ -431,6 +435,12 @@ Zotero.Items = function() {
|
|||
let endLen = 6; // "</div>".length
|
||||
note = note.substr(startLen, note.length - startLen - endLen);
|
||||
}
|
||||
// Clear null notes
|
||||
else {
|
||||
note = '';
|
||||
notesToUpdate.push([item.id, '']);
|
||||
}
|
||||
}
|
||||
|
||||
item._noteText = note ? note : '';
|
||||
item._loaded.note = true;
|
||||
|
|
Loading…
Add table
Reference in a new issue