mirror of
https://github.com/processing/processing4.git
synced 2026-02-15 03:15:40 +01:00
add check to make sure preceding slash not used w/ getChild
This commit is contained in:
@@ -355,6 +355,9 @@ public class XML implements Serializable {
|
||||
* @return the first matching element
|
||||
*/
|
||||
public XML getChild(String name) {
|
||||
if (name.length() > 0 && name.charAt(0) == '/') {
|
||||
throw new IllegalArgumentException("getChild() should not begin with a slash");
|
||||
}
|
||||
if (name.indexOf('/') != -1) {
|
||||
return getChildRecursive(PApplet.split(name, '/'), 0);
|
||||
}
|
||||
@@ -413,6 +416,9 @@ public class XML implements Serializable {
|
||||
* @author processing.org
|
||||
*/
|
||||
public XML[] getChildren(String name) {
|
||||
if (name.length() > 0 && name.charAt(0) == '/') {
|
||||
throw new IllegalArgumentException("getChildren() should not begin with a slash");
|
||||
}
|
||||
if (name.indexOf('/') != -1) {
|
||||
return getChildrenRecursive(PApplet.split(name, '/'), 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user