diff --git a/common/src/main/java/bisq/common/proto/ProtoUtil.java b/common/src/main/java/bisq/common/proto/ProtoUtil.java index 6fd7b0f2e5..da3cf02977 100644 --- a/common/src/main/java/bisq/common/proto/ProtoUtil.java +++ b/common/src/main/java/bisq/common/proto/ProtoUtil.java @@ -66,6 +66,10 @@ public class ProtoUtil { */ @Nullable public static > E enumFromProto(Class enumType, String name) { + if (name == null) { + return null; + } + E result = Enums.getIfPresent(enumType, name).orNull(); if (result == null) { log.error("Invalid value for enum " + enumType.getSimpleName() + ": " + name); @@ -77,7 +81,8 @@ public class ProtoUtil { return result; } - public static Iterable collectionToProto(Collection collection, Class messageType) { + public static Iterable collectionToProto(Collection collection, + Class messageType) { return collection.stream() .map(e -> { final Message message = e.toProtoMessage(); @@ -92,7 +97,8 @@ public class ProtoUtil { .collect(Collectors.toList()); } - public static Iterable collectionToProto(Collection collection, Function extra) { + public static Iterable collectionToProto(Collection collection, + Function extra) { return collection.stream().map(o -> extra.apply(o.toProtoMessage())).collect(Collectors.toList()); } }