[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-lib/master] Fix possible NPE in tests.



commit f5f6e5971c9f5d42fa9698526d8716a0f13deebc
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
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);
     }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits