chiark / gitweb /
The Java console keeps showing up error reports due to being asked
authorSimon Tatham <anakin@pobox.com>
Thu, 26 Jun 2008 19:07:44 +0000 (19:07 +0000)
committerSimon Tatham <anakin@pobox.com>
Thu, 26 Jun 2008 19:07:44 +0000 (19:07 +0000)
to resize the puzzle to zero size. Ignore all such requests, in the
assumption that a more sensible resize will be along soon enough
(which does seem to happen, though I haven't debugged the NestedVM
front end hard enough to figure out why the bogus resizes happen in
the first place).

[originally from svn r8094]

PuzzleApplet.java

index 4c9928d3cd38afe150d1d8549f553343db295644..ef7ca7e507ae52d5a08daa8ab3dcfba5bfe135ab 100644 (file)
@@ -476,11 +476,13 @@ public class PuzzleApplet extends JApplet implements Runtime.CallJavaCB {
         }
 
         public void createBackBuffer(int w, int h, Color bg) {
-            backBuffer = new BufferedImage(w,h, BufferedImage.TYPE_3BYTE_BGR);
-            Graphics g = backBuffer.createGraphics();
-            g.setColor(bg);
-            g.fillRect(0, 0, w, h);
-            g.dispose();
+           if (w > 0 && h > 0) {
+               backBuffer = new BufferedImage(w,h, BufferedImage.TYPE_3BYTE_BGR);
+               Graphics g = backBuffer.createGraphics();
+               g.setColor(bg);
+               g.fillRect(0, 0, w, h);
+               g.dispose();
+           }
         }
 
         protected void paintComponent(Graphics g) {