From 9de0f9f31e2524ccb5843b631ded9c4ba09f5a17 Mon Sep 17 00:00:00 2001 From: theultimatequestion Date: Wed, 5 Jul 2023 15:35:53 +0000 Subject: [PATCH] Test for null, avoid NPE fix OpenTSDB#2280 --- src/tsd/GraphHandler.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/tsd/GraphHandler.java b/src/tsd/GraphHandler.java index 2af125ede..9d8ae2c32 100644 --- a/src/tsd/GraphHandler.java +++ b/src/tsd/GraphHandler.java @@ -204,10 +204,12 @@ private void doGraph(final TSDB tsdb, final HttpQuery query) } options = query.getQueryStringParams("o"); - for (int i = 0; i < options.size(); i++) { - if (!allow_list.contains(options.get(i))) { - throw new BadRequestException("Query option at index " + i - + " was not in the allow list."); + if (!(options == null)) { + for (int i = 0; i < options.size(); i++) { + if (!allow_list.contains(options.get(i))) { + throw new BadRequestException("Query option at index " + i + + " was not in the allow list."); + } } } }