Fixes if last focused wallet is undefined
This commit is contained in:
parent
39e85396db
commit
19f6118f7f
2 changed files with 10 additions and 2 deletions
|
|
@ -148,10 +148,18 @@ Profile.prototype.setLastFocusedTs = function(walletId, cb) {
|
||||||
|
|
||||||
Profile.prototype.getLastFocusedWallet = function() {
|
Profile.prototype.getLastFocusedWallet = function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var last;
|
||||||
var maxTs = _.max(_.pluck(self.walletInfos, 'lastFocusedTs'));
|
var maxTs = _.max(_.pluck(self.walletInfos, 'lastFocusedTs'));
|
||||||
var last = _.findWhere(_.values(self.walletInfos), {
|
var wallets = _.values(self.walletInfos);
|
||||||
|
|
||||||
|
last = _.findWhere(wallets, {
|
||||||
lastFocusedTs: maxTs
|
lastFocusedTs: maxTs
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!last) {
|
||||||
|
last = _.last(wallets);
|
||||||
|
}
|
||||||
|
|
||||||
return last ? last.id : null;
|
return last ? last.id : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<div ng-controller="SidebarController">
|
<div ng-controller="SidebarController">
|
||||||
<header ng-click="toggleWalletSelection()">
|
<header ng-click="toggleWalletSelection()" ng-show="$root.wallet">
|
||||||
<!-- <div ng-show="$root.wallet.isShared()" ng-include="'views/includes/peer-list.html'"></div> -->
|
<!-- <div ng-show="$root.wallet.isShared()" ng-include="'views/includes/peer-list.html'"></div> -->
|
||||||
<div class="col1 avatar-wallet m10r">
|
<div class="col1 avatar-wallet m10r">
|
||||||
<span>P</span>
|
<span>P</span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue