Index: /applications/editors/josm/plugins/routes/josm-routes.launch
===================================================================
--- /applications/editors/josm/plugins/routes/josm-routes.launch	(revision 16683)
+++ /applications/editors/josm/plugins/routes/josm-routes.launch	(revision 16683)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/JOSM/src/org/openstreetmap/josm/gui/MainApplication.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JDK 6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.openstreetmap.josm.gui.MainApplication"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="josm-routes"/>
+</launchConfiguration>
Index: /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java
===================================================================
--- /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java	(revision 16682)
+++ /applications/editors/josm/plugins/routes/src/org/openstreetmap/josm/plugins/routes/RouteLayer.java	(revision 16683)
@@ -11,4 +11,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.DataSet;
 import org.openstreetmap.josm.data.osm.Relation;
 import org.openstreetmap.josm.data.osm.RelationMember;
@@ -30,10 +31,10 @@
 	private final PathBuilder pathBuilder = new PathBuilder();
 	private final List<RouteDefinition> routes = new ArrayList<RouteDefinition>();
-	
+
 	public RouteLayer(RoutesXMLLayer xmlLayer) {
 		super(xmlLayer.getName());
-		
+
 		int index = 0;
-		for (RoutesXMLRoute route:xmlLayer.getRoute()) {			
+		for (RoutesXMLRoute route:xmlLayer.getRoute()) {
 			if (route.isEnabled()) {
 				Color color = ColorHelper.html2color(route.getColor());
@@ -45,5 +46,5 @@
 			}
 		}
-		
+
 		if ("wide".equals(Main.pref.get("routes.painter"))) {
 			pathPainter = new WideLinePainter(this);
@@ -80,5 +81,5 @@
 	@Override
 	public void mergeFrom(Layer from) {
-
+		// Merging is not supported
 	}
 
@@ -89,5 +90,5 @@
 				pathBuilder.addWay(way, route);
 			}
-		}		
+		}
 	}
 
@@ -95,15 +96,21 @@
 	public void paint(Graphics g, MapView mv) {
 
+		DataSet dataset = Main.main.getCurrentDataSet();
+
+		if (dataset == null) {
+			return;
+		}
+
 		pathBuilder.clear();
 
-		for (Relation relation:Main.main.getCurrentDataSet().relations) {
+		for (Relation relation:dataset.relations) {
 			for (RouteDefinition route:routes) {
 				if (route.matches(relation)) {
 					addRelation(relation, route);
 				}
-			}			
+			}
 		}
 
-		for (Way way:Main.main.getCurrentDataSet().ways) {
+		for (Way way:dataset.ways) {
 			for (RouteDefinition route:routes) {
 				if (route.matches(way)) {
@@ -122,5 +129,5 @@
 
 	}
-	
+
 	public List<RouteDefinition> getRoutes() {
 		return routes;
