mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-01-03 17:40:10 +00:00
fix npe on first start with offline --xmrNode
This commit is contained in:
parent
606b2cef23
commit
fd0bf23867
2 changed files with 14 additions and 6 deletions
|
@ -131,7 +131,7 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
||||||
private boolean denyApiTaker;
|
private boolean denyApiTaker;
|
||||||
private boolean notifyOnPreRelease;
|
private boolean notifyOnPreRelease;
|
||||||
|
|
||||||
private MoneroNodeSettings moneroNodeSettings;
|
private MoneroNodeSettings moneroNodeSettings = new MoneroNodeSettings();
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|
|
@ -20,18 +20,25 @@ import haveno.common.proto.persistable.PersistableEnvelope;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MoneroNodeSettings implements PersistableEnvelope {
|
public class MoneroNodeSettings implements PersistableEnvelope {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
String blockchainPath;
|
String blockchainPath;
|
||||||
|
@Nullable
|
||||||
String bootstrapUrl;
|
String bootstrapUrl;
|
||||||
|
@Nullable
|
||||||
List<String> startupFlags;
|
List<String> startupFlags;
|
||||||
|
|
||||||
|
public MoneroNodeSettings() {
|
||||||
|
}
|
||||||
|
|
||||||
public static MoneroNodeSettings fromProto(protobuf.MoneroNodeSettings proto) {
|
public static MoneroNodeSettings fromProto(protobuf.MoneroNodeSettings proto) {
|
||||||
return new MoneroNodeSettings(
|
return new MoneroNodeSettings(
|
||||||
proto.getBlockchainPath(),
|
proto.getBlockchainPath(),
|
||||||
|
@ -41,9 +48,10 @@ public class MoneroNodeSettings implements PersistableEnvelope {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public protobuf.MoneroNodeSettings toProtoMessage() {
|
public protobuf.MoneroNodeSettings toProtoMessage() {
|
||||||
return protobuf.MoneroNodeSettings.newBuilder()
|
protobuf.MoneroNodeSettings.Builder builder = protobuf.MoneroNodeSettings.newBuilder();
|
||||||
.setBlockchainPath(blockchainPath)
|
Optional.ofNullable(blockchainPath).ifPresent(e -> builder.setBlockchainPath(blockchainPath));
|
||||||
.setBootstrapUrl(bootstrapUrl)
|
Optional.ofNullable(bootstrapUrl).ifPresent(e -> builder.setBlockchainPath(bootstrapUrl));
|
||||||
.addAllStartupFlags(startupFlags).build();
|
Optional.ofNullable(startupFlags).ifPresent(e -> builder.addAllStartupFlags(startupFlags));
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue