We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexSuggestions & BugsSoftware Bugs › Exception on endShape() if no calls to vertex()
Page Index Toggle Pages: 1
Exception on endShape() if no calls to vertex() (Read 1218 times)
Exception on endShape() if no calls to vertex()
Apr 19th, 2005, 10:02pm
 
Only with the JAVA2D renderer - not the others.

Code:


class Point {
float x,y;
}

Point points[];
int numPoints = 0;

void setup() {
size(300,300);
points = new Point[30];
}

void draw() {
background(255);
beginShape(LINE_LOOP);
for (int i = 0; i < numPoints; i++) {
Point p = points[i];
vertex(p.x,p.y);
}
endShape();
if (mousePressed) {
points[numPoints] = new Point();
points[numPoints].x = mouseX;
points[numPoints].y = mouseY;
numPoints++;
numPoints%=points.length;
}
}






exception occurred (if you don't see a stack trace below this message, we've got a bug)

java.lang.NullPointerException
     at processing.core.PGraphics2.endShape(PGraphics2.java:397)
     at processing.core.PApplet.endShape(PApplet.java:5165)
     at Temporary_7258_9918.draw(Temporary_7258_9918.java:21)



Windows 2000 and Windows XP SP2, non-expert 0085.
Re: Exception on endShape() if no calls to vertex(
Reply #1 - May 1st, 2005, 8:20am
 
fixed for 86.
Page Index Toggle Pages: 1