FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bounds check with setVertex(PVector) (fixes #2556) · hayscoding/processing@2ae4c6e · GitHub

Repository navigation

Commit 2ae4c6e

Browse files
committed
bounds check with setVertex(PVector) (fixes processing#2556)
1 parent 291be60 commit 2ae4c6e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎core/src/processing/core/PShape.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2065,7 +2065,12 @@ public void setVertex(int index, PVector vec) {
20652065

20662066
vertices[index][X] = vec.x;
20672067
vertices[index][Y] = vec.y;
2068-
vertices[index][Z] = vec.z;
2068+
2069+
if (vertices[index].length > 2) {
2070+
vertices[index][Z] = vec.z;
2071+
} else if (vec.z != 0 && vec.z == vec.z) {
2072+
throw new IllegalArgumentException("Cannot set a z-coordinate on a 2D shape");
2073+
}
20692074
}
20702075

20712076

‎core/todo.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ X https://github.com/processing/processing/issues/2228
44
X https://github.com/processing/processing/pull/2324
55
X move to native OS X full screen (gets rid of native code)
66
X https://github.com/processing/processing/issues/2641
7+
X do bounds check on setVertex(PVector)
8+
X https://github.com/processing/processing/issues/2556
79

810
data
911
X add copy() method to Table

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL