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

[tor-commits] [metrics-web/master] Handle possible NullPointerException.



commit 8868e6b2a859017e967848779de21740879bce67
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Wed Nov 29 10:37:18 2017 +0100

    Handle possible NullPointerException.
---
 .../java/org/torproject/metrics/web/graphs/RObjectGenerator.java  | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/website/src/main/java/org/torproject/metrics/web/graphs/RObjectGenerator.java b/website/src/main/java/org/torproject/metrics/web/graphs/RObjectGenerator.java
index 7477303..c81d4dd 100644
--- a/website/src/main/java/org/torproject/metrics/web/graphs/RObjectGenerator.java
+++ b/website/src/main/java/org/torproject/metrics/web/graphs/RObjectGenerator.java
@@ -215,8 +215,12 @@ public class RObjectGenerator implements ServletContextListener {
     /* See if we need to generate this table. */
     File tableFile = new File(this.cachedGraphsDirectory + "/"
         + tableFilename);
-    byte[] tableBytes = this.generateObject(query, tableFile,
-        tableFilename, checkCache).getBytes();
+    RObject tableObject = this.generateObject(query, tableFile,
+        tableFilename, checkCache);
+    if (null == tableObject) {
+      return null;
+    }
+    byte[] tableBytes = tableObject.getBytes();
 
     /* Write the table content to a map. */
     List<Map<String, String>> result = new ArrayList<>();



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