Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #11804 from NejcZdovc/hotfix/#11703-typeError
Browse files Browse the repository at this point in the history
Fixes undefined scenarios
  • Loading branch information
bsclifton committed Nov 7, 2017
1 parent 54fecec commit 5e5bbb2
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 @@ -2394,12 +2394,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 @@ -2420,7 +2420,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 @@ -2447,6 +2446,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 5e5bbb2

Please sign in to comment.