[tor-commits] [metrics-lib/master] Fix possible NPE in tests.
karsten at torproject.org
karsten at torproject.org
Wed Nov 20 16:47:55 UTC 2019
commit f5f6e5971c9f5d42fa9698526d8716a0f13deebc
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Wed Nov 20 17:34:59 2019 +0100
Fix possible NPE in tests.
---
.../java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java b/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
index bd1d1d2..8e4424c 100644
--- a/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
+++ b/src/test/java/org/torproject/descriptor/impl/ServerDescriptorImplTest.java
@@ -453,6 +453,9 @@ public class ServerDescriptorImplTest {
private ServerDescriptorImpl buildDescriptor()
throws DescriptorParseException {
byte[] descriptorBytes = this.buildDescriptorBytes();
+ if (null == descriptorBytes) {
+ descriptorBytes = new byte[0];
+ }
return new RelayServerDescriptorImpl(descriptorBytes,
new int[] { 0, descriptorBytes.length }, null);
}
More information about the tor-commits
mailing list