Skip to content

Commit 549635c

Browse files
committed
Quit find if previous section of chained query returns null
1 parent 8974446 commit 549635c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/javafxlibrary/utils/Finder.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,15 @@ private String parseWholeQuery(String query) {
135135

136136
for (int i = 1; i < queryArray.length; i++) {
137137
if (containsPrefixes(queryArray[i])) {
138-
String[] rootQuery = Arrays.copyOfRange(queryArray, 0, i );
139-
this.currentRoot = (Parent) newFind(String.join(" ", rootQuery));
138+
String rootQuery = String.join(" ", Arrays.copyOfRange(queryArray, 0, i ));
139+
RobotLog.debug("Finding next root using query: " + rootQuery);
140+
this.currentRoot = (Parent) newFind(rootQuery);
141+
RobotLog.debug("New root set for find: " + this.currentRoot);
142+
143+
if (this.currentRoot == null)
144+
throw new JavaFXLibraryNonFatalException("Could not find a Parent node with query: \"" +
145+
rootQuery + "\" to be used as the next root node, quitting find!");
146+
140147
String[] remainingQuery = Arrays.copyOfRange(queryArray, i, queryArray.length);
141148
query = String.join(" ", remainingQuery);
142149
break;

0 commit comments

Comments
 (0)