Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Check bounds in drawPoint().
[graphlib_java.git] / DrawingWindow.java
index 1b93c57..957f5ff 100644 (file)
@@ -34,7 +34,7 @@ import javax.swing.JPanel;
  * possible de fermer la fenĂȘtre via le gestionnaire de fenĂȘtres.
  *
  * @author Arnaud Giersch <arnaud.giersch@univ-fcomte.fr>
- * @version 20141021
+ * @version 20141021a
  */
 public class DrawingWindow {
 
@@ -242,6 +242,8 @@ public class DrawingWindow {
      * @see #setColor
      */
     public void drawPoint(int x, int y) {
+        if (x < 0 || y < 0 || x >= width || y >= height)
+            return;
         synchronized (image) {
             image.setRGB(x, y, graphics.getColor().getRGB());
         }