mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
fix npe configuring recent blocks view on new installs
This commit is contained in:
parent
098afebbe0
commit
853949675e
2 changed files with 13 additions and 4 deletions
|
|
@ -52,7 +52,10 @@ public class BlockCube extends Group {
|
|||
public BlockCube(Integer weight, Double medianFee, Integer height, Integer txCount, Long timestamp, boolean confirmed) {
|
||||
getStyleClass().addAll("block-" + Network.getCanonical().getName(), "block-cube");
|
||||
this.confirmedProperty.set(confirmed);
|
||||
this.feeRatesSource.set(Config.get().getFeeRatesSource());
|
||||
|
||||
FeeRatesSource feeRatesSource = Config.get().getFeeRatesSource();
|
||||
feeRatesSource = (feeRatesSource == null ? FeeRatesSource.MEMPOOL_SPACE : feeRatesSource);
|
||||
this.feeRatesSource.set(feeRatesSource);
|
||||
|
||||
this.weightProperty.addListener((_, _, _) -> {
|
||||
if(front != null) {
|
||||
|
|
@ -198,6 +201,8 @@ public class BlockCube extends Group {
|
|||
} else {
|
||||
feeRateIcon.getChildren().clear();
|
||||
}
|
||||
} else {
|
||||
feeRateIcon.getChildren().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ public class RecentBlocksView extends Pane {
|
|||
}
|
||||
}));
|
||||
|
||||
updateFeeRatesSource(Config.get().getFeeRatesSource());
|
||||
FeeRatesSource feeRatesSource = Config.get().getFeeRatesSource();
|
||||
feeRatesSource = (feeRatesSource == null ? FeeRatesSource.MEMPOOL_SPACE : feeRatesSource);
|
||||
updateFeeRatesSource(feeRatesSource);
|
||||
Tooltip.install(this, tooltip);
|
||||
}
|
||||
|
||||
|
|
@ -140,9 +142,11 @@ public class RecentBlocksView extends Pane {
|
|||
|
||||
public void updateFeeRate(Map<Integer, Double> targetBlockFeeRates) {
|
||||
int defaultTarget = TARGET_BLOCKS_RANGE.get((TARGET_BLOCKS_RANGE.size() / 2) - 1);
|
||||
if(targetBlockFeeRates.get(defaultTarget) != null) {
|
||||
Double defaultRate = targetBlockFeeRates.get(defaultTarget);
|
||||
updateFeeRate(defaultRate);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFeeRate(Double currentFeeRate) {
|
||||
if(!getCubes().isEmpty()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue