File tree 2 files changed +10
-0
lines changed
main/java/kong/unirest/json
test/java/kong/unirest/json
2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,9 @@ public Object queryFrom(Object object) throws JSONPointerException {
178
178
Queryable e = verify (object );
179
179
Object o = e .querySection (section );
180
180
if (next != null ) {
181
+ if (o == null ){
182
+ throw new JSONPointerException ("Path Segment Missing: " + section );
183
+ }
181
184
return next .queryFrom (o );
182
185
}
183
186
return o ;
Original file line number Diff line number Diff line change @@ -51,6 +51,13 @@ public void invalidPathQuery() {
51
51
"a JSON pointer should start with '/' or '#/'" );
52
52
}
53
53
54
+ @ Test
55
+ public void invalidPathQuery_downpath () {
56
+ TestUtil .assertException (() -> obj .query ("/shwoop/dedoop" ),
57
+ JSONPointerException .class ,
58
+ "Path Segment Missing: shwoop" );
59
+ }
60
+
54
61
@ Test
55
62
public void arrayPartThatDoesNotExist () {
56
63
TestUtil .assertException (() -> obj .query ("/foo/5" ),
You can’t perform that action at this time.
0 commit comments