From: <adr...@us...> - 2009-07-27 11:31:00
|
Revision: 3202 http://reprap.svn.sourceforge.net/reprap/?rev=3202&view=rev Author: adrian-bowyer Date: 2009-07-27 11:30:36 +0000 (Mon, 27 Jul 2009) Log Message: ----------- Bug corrected whereby a non existent hatch would cause a null pointer exception for the middle-start code. Modified Paths: -------------- trunk/reprap/host/src/org/reprap/geometry/polygons/RrPolygonList.java Modified: trunk/reprap/host/src/org/reprap/geometry/polygons/RrPolygonList.java =================================================================== --- trunk/reprap/host/src/org/reprap/geometry/polygons/RrPolygonList.java 2009-07-26 18:04:30 UTC (rev 3201) +++ trunk/reprap/host/src/org/reprap/geometry/polygons/RrPolygonList.java 2009-07-27 11:30:36 UTC (rev 3202) @@ -929,29 +929,31 @@ Rr2Point start = outline.point(0); PolPoint pp = hatching.ppSearch(start); - pp.findLongEnough(10, 30); + if(pp != null) + { + pp.findLongEnough(10, 30); - int st = pp.near(); - int en = pp.end(); + int st = pp.near(); + int en = pp.end(); - RrPolygon pg = pp.polygon(); - - outline.add(start); - - if(en >= st) - { - for(int j = st; j <= en; j++) - outline.add(0, pg.point(j)); - } else - { - for(int j = st; j >= en; j--) - outline.add(0, pg.point(j)); + RrPolygon pg = pp.polygon(); + + outline.add(start); + + if(en >= st) + { + for(int j = st; j <= en; j++) + outline.add(0, pg.point(j)); + } else + { + for(int j = st; j >= en; j--) + outline.add(0, pg.point(j)); + } + + set(i, outline); + + hatching.cutPolygon(pp.pIndex(), st, en); } - - set(i, outline); - - hatching.cutPolygon(pp.pIndex(), st, en); - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |