Add error checking when importing a wallet from a corrupt file

This commit is contained in:
Matias Pando 2014-11-17 17:44:38 -03:00
parent cfb29e8e8f
commit 05c8200749
1 changed files with 5 additions and 1 deletions

View File

@ -1035,8 +1035,12 @@ Wallet.fromObj = function(o, readOpts) {
// TODO Why moving everything to opts. This needs refactoring.
//
// clone opts
var opts = JSON.parse(JSON.stringify(o.opts));
if (!o.opts) {
return null;
}
var opts = JSON.parse(JSON.stringify(o.opts));
opts.addressBook = o.addressBook;
opts.settings = o.settings;