Skip to content

Commit

Permalink
Update pickle.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Dec 21, 2021
1 parent 364f3ae commit 6e87116
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion source/pickle.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ pickle.ModelFactory = class {
context.exception(new pickle.Error('Unknown Pickle null object.'));
}
else if (Array.isArray(obj)) {
context.exception(new pickle.Error('Unknown Pickle array object.'));
if (obj.length > 0 && obj[0] && obj.every((item) => item && item.__class__ && obj[0].__class__ && item.__class__.__module__ === obj[0].__class__.__module__ && item.__class__.__name__ === obj[0].__class__.__name__)) {
const type = obj[0].__class__.__module__ + "." + obj[0].__class__.__name__;
context.exception(new pickle.Error("Unknown Pickle '" + type + "' array object."));
}
else {
context.exception(new pickle.Error('Unknown Pickle array object.'));
}
}
else if (obj && obj.__class__) {
const formats = new Map([
Expand Down

0 comments on commit 6e87116

Please sign in to comment.