Index: trunk/src/org/openstreetmap/josm/tools/ImageResource.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ImageResource.java	(revision 16053)
+++ trunk/src/org/openstreetmap/josm/tools/ImageResource.java	(revision 16054)
@@ -155,6 +155,6 @@
      */
     public ImageIcon getImageIcon(Dimension dim, boolean multiResolution) {
-        if (dim.width < -1 || dim.width == 0 || dim.height < -1 || dim.height == 0)
-            throw new IllegalArgumentException(dim+" is invalid");
+        CheckParameterUtil.ensureThat((dim.width > 0 || dim.width == -1) && (dim.height > 0 || dim.height == -1),
+                () -> dim + " is invalid");
         BufferedImage img = imgCache.get(dim);
         if (img == null) {
@@ -243,6 +243,6 @@
      */
     public ImageIcon getImageIconBounded(Dimension maxSize, boolean multiResolution) {
-        if (maxSize.width < -1 || maxSize.width == 0 || maxSize.height < -1 || maxSize.height == 0)
-            throw new IllegalArgumentException(maxSize+" is invalid");
+        CheckParameterUtil.ensureThat((maxSize.width > 0 || maxSize.width == -1) && (maxSize.height > 0 || maxSize.height == -1),
+                () -> maxSize + " is invalid");
         float sourceWidth;
         float sourceHeight;
