Index: trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 1940)
+++ trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java	(revision 1941)
@@ -292,5 +292,8 @@
         double minDistanceSq = snapDistance;
         Node minPrimitive = null;
-        for (Node n : getCurrentDataSet().nodes) {
+        DataSet ds = getCurrentDataSet();
+        if(ds == null)
+            return null;
+        for (Node n : ds.nodes) {
             if (n.deleted || n.incomplete) {
                 continue;
@@ -320,5 +323,8 @@
     public final List<WaySegment> getNearestWaySegments(Point p) {
         TreeMap<Double, List<WaySegment>> nearest = new TreeMap<Double, List<WaySegment>>();
-        for (Way w : getCurrentDataSet().ways) {
+        DataSet ds = getCurrentDataSet();
+        if(ds == null)
+            return null;
+        for (Way w : ds.ways) {
             if (w.deleted || w.incomplete) {
                 continue;
@@ -376,4 +382,6 @@
     public final WaySegment getNearestWaySegment(Point p, Collection<WaySegment> ignore) {
         List<WaySegment> nearest = getNearestWaySegments(p);
+        if(nearest == null)
+            return null;
         if (ignore != null) {
             nearest.removeAll(ignore);
@@ -439,5 +447,8 @@
     public Collection<OsmPrimitive> getAllNearest(Point p) {
         Collection<OsmPrimitive> nearest = new HashSet<OsmPrimitive>();
-        for (Way w : getCurrentDataSet().ways) {
+        DataSet ds = getCurrentDataSet();
+        if(ds == null)
+            return null;
+        for (Way w : ds.ways) {
             if (w.deleted || w.incomplete) {
                 continue;
@@ -465,5 +476,5 @@
             }
         }
-        for (Node n : getCurrentDataSet().nodes) {
+        for (Node n : ds.nodes) {
             if (!n.deleted && !n.incomplete
                     && getPoint(n).distanceSq(p) < snapDistance) {
@@ -484,5 +495,8 @@
     public Collection<Node> getNearestNodes(Point p) {
         Collection<Node> nearest = new HashSet<Node>();
-        for (Node n : getCurrentDataSet().nodes) {
+        DataSet ds = getCurrentDataSet();
+        if(ds == null)
+            return null;
+        for (Node n : ds.nodes) {
             if (!n.deleted && !n.incomplete
                     && getPoint(n).distanceSq(p) < snapDistance) {
