Help with Graph

Hi

I need a bit of help with the graph example on the Arduino website, some times it works fine but most of the the time it errors with the following error

java.lang.StringIndexOutOfBoundsException: String index out of range: -1

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1768)
at Temporary_1107_1574.serialEvent(Temporary_1107_1574.java:60)
at Temporary_1107_1574.draw(Temporary_1107_1574.java:48)
at processing.core.PApplet.handleDisplay(PApplet.java:1465)
at processing.core.PGraphics.requestDisplay(PGraphics.java:690)
at processing.core.PApplet.run(PApplet.java:1562)
at java.lang.Thread.run(Thread.java:613)

at java.lang.String.substring(String.java:1768)
at Temporary_1107_1574.serialEvent(Temporary_1107_1574.java:60)
at Temporary_1107_1574.draw(Temporary_1107_1574.java:48)
at processing.core.PApplet.handleDisplay(PApplet.java:1465)
at processing.core.PGraphics.requestDisplay(PGraphics.java:690)
at processing.core.PApplet.run(PApplet.java:1562)
at java.lang.Thread.run(Thread.java:613)

is there nay thing stupid i am doing ???? any help would be greatly appricated

Cheers

James

It's not you - the example is not very robust (to try to keep it simple). You might try holding down the reset button on your board while running the Processing sketch, and letting go of reset after the Processing sketch has started.