Skip to content

Commit

Permalink
Merge pull request brave#11804 from NejcZdovc/hotfix/brave#11703-type…
Browse files Browse the repository at this point in the history
…Error

Fixes undefined scenarios
  • Loading branch information
bsclifton authored Nov 7, 2017
2 parents 8ea4abe + 3255d9c commit 3bb444e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2367,12 +2367,12 @@ const transitionWalletToBat = () => {
let newPaymentId, result

if (newClient === true) return
clientprep()

// Restore newClient from the file
if (!newClient) {
const fs = require('fs')
try {
clientprep()
fs.accessSync(pathName(newClientPath), fs.FF_OK)
fs.readFile(pathName(newClientPath), (error, data) => {
if (error) {
Expand All @@ -2393,7 +2393,6 @@ const transitionWalletToBat = () => {
// Create new client
if (!newClient) {
try {
clientprep()
newClient = ledgerClient(null, underscore.extend({roundtrip: roundtrip}, clientOptions), null)
muonWriter(newClientPath, newClient.state)
} catch (ex) {
Expand All @@ -2420,6 +2419,11 @@ const transitionWalletToBat = () => {
return
}

if (!client) {
console.log('Client is not initialized, will try again')
return
}

if (client.busyP()) {
console.log('ledger client is currently busy; transition will be retried on next launch')
return
Expand Down

0 comments on commit 3bb444e

Please sign in to comment.