Index: trunk/src/org/openstreetmap/josm/tools/ImageResource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageResource.java	(revision 6289)
+++ trunk/src/org/openstreetmap/josm/tools/ImageResource.java	(revision 6290)
@@ -71,7 +71,7 @@
             ImageIcon icon = new ImageIcon(base);
             if (width == -1) {
-                width = icon.getIconWidth() * height / icon.getIconHeight();
+                width = Math.max(1, icon.getIconWidth() * height / icon.getIconHeight());
             } else if (height == -1) {
-                height = icon.getIconHeight() * width / icon.getIconWidth();
+                height = Math.max(1, icon.getIconHeight() * width / icon.getIconWidth());
             }
             Image i = icon.getImage().getScaledInstance(width, height, Image.SCALE_SMOOTH);
