mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-24 06:49:31 -05:00
fix npe opening deposit view without monero connection #431
This commit is contained in:
parent
7fc2f5de52
commit
c193385475
@ -162,7 +162,11 @@ class DepositListItem {
|
|||||||
|
|
||||||
// get tx with fewest confirmations
|
// get tx with fewest confirmations
|
||||||
MoneroTxWallet highestTx = null;
|
MoneroTxWallet highestTx = null;
|
||||||
for (MoneroTxWallet tx : txs) if (highestTx == null || tx.getNumConfirmations() < highestTx.getNumConfirmations()) highestTx = tx;
|
for (MoneroTxWallet tx : txs) {
|
||||||
|
if (highestTx == null || tx.getHeight() == null || (highestTx.getHeight() != null && tx.getHeight() > highestTx.getHeight())) {
|
||||||
|
highestTx = tx;
|
||||||
|
}
|
||||||
|
}
|
||||||
return highestTx;
|
return highestTx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,12 +318,14 @@ public class DepositView extends ActivatableView<VBox, Void> {
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private void updateList() {
|
private void updateList() {
|
||||||
observableList.forEach(DepositListItem::cleanup);
|
|
||||||
observableList.clear();
|
|
||||||
|
|
||||||
// cache incoming txs
|
// cache incoming txs
|
||||||
txsWithIncomingOutputs = xmrWalletService.getTxsWithIncomingOutputs();
|
txsWithIncomingOutputs = xmrWalletService.getTxsWithIncomingOutputs();
|
||||||
|
|
||||||
|
// clear existing items
|
||||||
|
observableList.forEach(DepositListItem::cleanup);
|
||||||
|
observableList.clear();
|
||||||
|
|
||||||
// add address entries
|
// add address entries
|
||||||
xmrWalletService.getAddressEntries()
|
xmrWalletService.getAddressEntries()
|
||||||
.forEach(e -> observableList.add(new DepositListItem(e, xmrWalletService, formatter, txsWithIncomingOutputs)));
|
.forEach(e -> observableList.add(new DepositListItem(e, xmrWalletService, formatter, txsWithIncomingOutputs)));
|
||||||
|
@ -528,7 +528,7 @@ public class GUIUtil {
|
|||||||
public static void updateConfidence(MoneroTx tx,
|
public static void updateConfidence(MoneroTx tx,
|
||||||
Tooltip tooltip,
|
Tooltip tooltip,
|
||||||
TxConfidenceIndicator txConfidenceIndicator) {
|
TxConfidenceIndicator txConfidenceIndicator) {
|
||||||
if (tx != null && !tx.isRelayed()) {
|
if (tx != null && (tx.getNumConfirmations() == null || !tx.isRelayed())) {
|
||||||
tooltip.setText(Res.get("confidence.unknown"));
|
tooltip.setText(Res.get("confidence.unknown"));
|
||||||
txConfidenceIndicator.setProgress(0);
|
txConfidenceIndicator.setProgress(0);
|
||||||
} else if (tx != null && tx.isFailed()) {
|
} else if (tx != null && tx.isFailed()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user