Program: 109198
Project: 109198
Buggy source:
protected void drawPath(PGraphics g){
  if (vertices == null)   return;
  g.beginShape();
  if (vertexCodeCount == 0) {
    if (vertices[0].length == 2) {
      for (int i=0; i < vertexCount; i++) {
        g.vertex(vertices[i][X],vertices[i][Y]);
      }
    }
 else {
      for (int i=0; i < vertexCount; i++) {
        g.vertex(vertices[i][X],vertices[i][Y],vertices[i][Z]);
      }
    }
  }
 else {
    int index=0;
    if (vertices[0].length == 2) {
      for (int j=0; j < vertexCodeCount; j++) {
switch (vertexCodes[j]) {
case VERTEX:
          g.vertex(vertices[index][X],vertices[index][Y]);
        index++;
      break;
case BEZIER_VERTEX:
    g.bezierVertex(vertices[index + 0][X],vertices[index + 0][Y],vertices[index + 1][X],vertices[index + 1][Y],vertices[index + 2][X],vertices[index + 2][Y]);
  index+=3;
break;
case CURVE_VERTEX:
g.curveVertex(vertices[index][X],vertices[index][Y]);
index++;
case BREAK:
g.breakShape();
}
}
}
 else {
for (int j=0; j < vertexCodeCount; j++) {
switch (vertexCodes[j]) {
case VERTEX:
g.vertex(vertices[index][X],vertices[index][Y],vertices[index][Z]);
index++;
break;
case BEZIER_VERTEX:
g.bezierVertex(vertices[index + 0][X],vertices[index + 0][Y],vertices[index + 0][Z],vertices[index + 1][X],vertices[index + 1][Y],vertices[index + 1][Z],vertices[index + 2][X],vertices[index + 2][Y],vertices[index + 2][Z]);
index+=3;
break;
case CURVE_VERTEX:
g.curveVertex(vertices[index][X],vertices[index][Y],vertices[index][Z]);
index++;
case BREAK:
g.breakShape();
}
}
}
}
g.endShape(close ? CLOSE : OPEN);
}

Fixed version (ground truth):
protected void drawPath(PGraphics g){
  if (vertices == null)   return;
  g.beginShape();
  if (vertexCodeCount == 0) {
    if (vertices[0].length == 2) {
      for (int i=0; i < vertexCount; i++) {
        g.vertex(vertices[i][X],vertices[i][Y]);
      }
    }
 else {
      for (int i=0; i < vertexCount; i++) {
        g.vertex(vertices[i][X],vertices[i][Y],vertices[i][Z]);
      }
    }
  }
 else {
    int index=0;
    if (vertices[0].length == 2) {
      for (int j=0; j < vertexCodeCount; j++) {
switch (vertexCodes[j]) {
case VERTEX:
          g.vertex(vertices[index][X],vertices[index][Y]);
        index++;
      break;
case QUAD_BEZIER_VERTEX:
    g.quadVertex(vertices[index + 0][X],vertices[index + 0][Y],vertices[index + 1][X],vertices[index + 1][Y]);
  index+=2;
break;
case BEZIER_VERTEX:
g.bezierVertex(vertices[index + 0][X],vertices[index + 0][Y],vertices[index + 1][X],vertices[index + 1][Y],vertices[index + 2][X],vertices[index + 2][Y]);
index+=3;
break;
case CURVE_VERTEX:
g.curveVertex(vertices[index][X],vertices[index][Y]);
index++;
case BREAK:
g.breakShape();
}
}
}
 else {
for (int j=0; j < vertexCodeCount; j++) {
switch (vertexCodes[j]) {
case VERTEX:
g.vertex(vertices[index][X],vertices[index][Y],vertices[index][Z]);
index++;
break;
case QUAD_BEZIER_VERTEX:
g.quadVertex(vertices[index + 0][X],vertices[index + 0][Y],vertices[index + 0][Z],vertices[index + 1][X],vertices[index + 1][Y],vertices[index + 0][Z]);
index+=2;
break;
case BEZIER_VERTEX:
g.bezierVertex(vertices[index + 0][X],vertices[index + 0][Y],vertices[index + 0][Z],vertices[index + 1][X],vertices[index + 1][Y],vertices[index + 1][Z],vertices[index + 2][X],vertices[index + 2][Y],vertices[index + 2][Z]);
index+=3;
break;
case CURVE_VERTEX:
g.curveVertex(vertices[index][X],vertices[index][Y],vertices[index][Z]);
index++;
case BREAK:
g.breakShape();
}
}
}
}
g.endShape(close ? CLOSE : OPEN);
}