Skip to content

Commit 5d4f4dd

Browse files
committed
deal with an NPE inside PShape
1 parent e77ce47 commit 5d4f4dd

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

core/src/processing/core/PShape.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,12 +2963,16 @@ public boolean isClosed() {
29632963
*/
29642964
public boolean contains(float x, float y) {
29652965
if (family == PATH) {
2966-
// apply the inverse transformation matrix to the point coordinates
2967-
PMatrix inverseCoords = matrix.get();
2968-
inverseCoords.invert(); // maybe cache this?
2969-
inverseCoords.invert(); // maybe cache this?
2970-
PVector p = new PVector();
2971-
inverseCoords.mult(new PVector(x,y),p);
2966+
PVector p = new PVector(x, y);
2967+
if (matrix != null) {
2968+
// apply the inverse transformation matrix to the point coordinates
2969+
PMatrix inverseCoords = matrix.get();
2970+
// TODO why is this called twice? [fry 190724]
2971+
// commit was https://github.com/processing/processing/commit/027fc7a4f8e8d0a435366eae754304eea282512a
2972+
inverseCoords.invert(); // maybe cache this?
2973+
inverseCoords.invert(); // maybe cache this?
2974+
inverseCoords.mult(new PVector(x, y), p);
2975+
}
29722976

29732977
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
29742978
boolean c = false;

0 commit comments

Comments
 (0)