better handling of invalid JSON objects
This commit is contained in:
parent
7d9493827e
commit
f6b1d6e56e
|
@ -131,7 +131,12 @@ Zotero.Translator = function(file) {
|
|||
if(!m) {
|
||||
this.logError("Invalid or missing translator metadata JSON object");
|
||||
} else {
|
||||
try {
|
||||
var info = Zotero.JSON.unserialize(m[0]);
|
||||
} catch(e) {
|
||||
this.logError("Invalid or missing translator metadata JSON object");
|
||||
}
|
||||
if(info) {
|
||||
var haveMetadata = true;
|
||||
// make sure we have all the properties
|
||||
for each(var property in ["translatorID", "translatorType", "label", "target", "lastUpdated"]) {
|
||||
|
@ -163,6 +168,7 @@ Zotero.Translator = function(file) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fStream.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user