Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java	(revision 11053)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/MapPaintSettings.java	(revision 11054)
@@ -346,3 +346,23 @@
         return outlineOnly;
     }
+
+    @Override
+    public String toString() {
+        // This is used for debugging exceptions.
+        return "MapPaintSettings [useRealWidth=" + useRealWidth + ", showDirectionArrow=" + showDirectionArrow
+                + ", showOnewayArrow=" + showOnewayArrow + ", defaultSegmentWidth=" + defaultSegmentWidth
+                + ", showOrderNumber=" + showOrderNumber + ", showHeadArrowOnly=" + showHeadArrowOnly
+                + ", showNamesDistance=" + showNamesDistance + ", useStrokesDistance=" + useStrokesDistance
+                + ", showIconsDistance=" + showIconsDistance + ", selectedNodeSize=" + selectedNodeSize
+                + ", connectionNodeSize=" + connectionNodeSize + ", unselectedNodeSize=" + unselectedNodeSize
+                + ", taggedNodeSize=" + taggedNodeSize + ", fillSelectedNode=" + fillSelectedNode
+                + ", fillUnselectedNode=" + fillUnselectedNode + ", fillTaggedNode=" + fillTaggedNode
+                + ", fillConnectionNode=" + fillConnectionNode + ", outlineOnly=" + outlineOnly + ", selectedColor="
+                + selectedColor + ", relationSelectedColor=" + relationSelectedColor + ", highlightColor="
+                + highlightColor + ", inactiveColor=" + inactiveColor + ", nodeColor=" + nodeColor + ", taggedColor="
+                + taggedColor + ", connectionColor=" + connectionColor + ", taggedConnectionColor="
+                + taggedConnectionColor + "]";
+    }
+
+
 }
Index: /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 11053)
+++ /trunk/src/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRenderer.java	(revision 11054)
@@ -83,4 +83,5 @@
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Utils;
+import org.openstreetmap.josm.tools.bugreport.BugReport;
 
 /**
@@ -242,4 +243,7 @@
     }
 
+    /**
+     * This stores a style and a primitive that should be painted with that style.
+     */
     public static class StyleRecord implements Comparable<StyleRecord> {
         private final StyleElement style;
@@ -297,4 +301,25 @@
         public StyleElement getStyle() {
             return style;
+        }
+
+        /**
+         * Paints the primitive with the style.
+         * @param paintSettings The settings to use.
+         * @param painter The painter to paint the style.
+         */
+        public void paintPrimitive(MapPaintSettings paintSettings, StyledMapRenderer painter) {
+            style.paintPrimitive(
+                    osm,
+                    paintSettings,
+                    painter,
+                    (flags & FLAG_SELECTED) != 0,
+                    (flags & FLAG_OUTERMEMBER_OF_SELECTED) != 0,
+                    (flags & FLAG_MEMBER_OF_SELECTED) != 0
+            );
+        }
+
+        @Override
+        public String toString() {
+            return "StyleRecord [style=" + style + ", osm=" + osm + ", flags=" + flags + "]";
         }
     }
@@ -1828,9 +1853,15 @@
             try {
                 for (final OsmPrimitive osm : input) {
-                    if (osm.isDrawable()) {
-                        osm.accept(this);
+                    try {
+                        if (osm.isDrawable()) {
+                            osm.accept(this);
+                        }
+                    } catch (RuntimeException e) {
+                        throw BugReport.intercept(e).put("osm", osm);
                     }
                 }
                 return output;
+            } catch (RuntimeException e) {
+                throw BugReport.intercept(e).put("input-size", input.size()).put("output-size", output.size());
             } finally {
                 MapCSSStyleSource.STYLE_SOURCE_LOCK.readLock().unlock();
@@ -1934,13 +1965,10 @@
             }
 
-            for (StyleRecord r : allStyleElems) {
-                r.style.paintPrimitive(
-                        r.osm,
-                        paintSettings,
-                        this,
-                        (r.flags & FLAG_SELECTED) != 0,
-                        (r.flags & FLAG_OUTERMEMBER_OF_SELECTED) != 0,
-                        (r.flags & FLAG_MEMBER_OF_SELECTED) != 0
-                );
+            for (StyleRecord record : allStyleElems) {
+                try {
+                    record.paintPrimitive(paintSettings, this);
+                } catch (RuntimeException e) {
+                    throw BugReport.intercept(e).put("record", record);
+                }
             }
 
@@ -1948,4 +1976,11 @@
 
             benchmark.renderDone();
+        } catch (RuntimeException e) {
+            throw BugReport.intercept(e)
+                    .put("data", data)
+                    .put("circum", circum)
+                    .put("scale", scale)
+                    .put("paintSettings", paintSettings)
+                    .put("renderVirtualNodes", renderVirtualNodes);
         } finally {
             data.getReadLock().unlock();
