Index: src/org/openstreetmap/josm/data/osm/DataSet.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/DataSet.java	(revision 15877)
+++ src/org/openstreetmap/josm/data/osm/DataSet.java	(working copy)
@@ -429,6 +429,21 @@
         }
     }
 
+    /**
+     * Searches for all primitives in the given bounding box
+     *
+     * @param bbox the bounding box
+     * @return List of primitives in the given bbox. Can be empty but not null
+     * @since xxx
+     */
+    public List<OsmPrimitive> searchPrimitives(BBox bbox) {
+        List<OsmPrimitive> primitiveList = new ArrayList<>();
+        primitiveList.addAll(searchNodes(bbox));
+        primitiveList.addAll(searchWays(bbox));
+        primitiveList.addAll(searchRelations(bbox));
+        return primitiveList;
+    }
+
     @Override
     public Collection<Relation> getRelations() {
         return getPrimitives(Relation.class::isInstance);
Index: src/org/openstreetmap/josm/data/osm/QuadBuckets.java
===================================================================
--- src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(revision 15877)
+++ src/org/openstreetmap/josm/data/osm/QuadBuckets.java	(working copy)
@@ -585,7 +585,7 @@
      */
     public List<T> search(BBox searchBbox) {
         List<T> ret = new ArrayList<>();
-        if (!searchBbox.isValid()) {
+        if (searchBbox == null || !searchBbox.isValid()) {
             return ret;
         }
 
Index: test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java
===================================================================
--- test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java	(revision 15877)
+++ test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java	(working copy)
@@ -13,6 +13,7 @@
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.TestUtils;
 import org.openstreetmap.josm.data.Bounds;
 import org.openstreetmap.josm.data.DataSource;
 import org.openstreetmap.josm.data.coor.LatLon;
@@ -67,6 +68,33 @@
     }
 
     /**
+     * Unit test for {@link DataSet#searchPrimitives}
+     */
+    @Test
+    public void testSearchPrimitives() {
+        final DataSet ds = new DataSet();
+        // null bbox => empty list
+        Assert.assertTrue("Empty data set should produce an empty list.", ds.searchPrimitives(null).isEmpty());
+
+        // empty data set, any bbox => empty list
+        BBox bbox = new BBox(new LatLon(-180, -90), new LatLon(180, 90));
+        Assert.assertTrue("Empty data set should produce an empty list.", ds.searchPrimitives(bbox).isEmpty());
+        // data set with elements in the given bbox => these elements
+        Node node = new Node(LatLon.ZERO);
+        Node node2 = new Node(new LatLon(-0.01, -0.01));
+        Way way = TestUtils.newWay("", node, node2);
+        Relation r = new Relation(1);
+        RelationMember rm = new RelationMember("role", node);
+        r.addMember(rm);
+        way.getNodes().forEach(ds::addPrimitive);
+        ds.addPrimitive(way);
+        ds.addPrimitive(r);
+        bbox = new BBox(new LatLon(-1.0, -1.0), new LatLon(1.0, 1.0));
+        List<OsmPrimitive> result = ds.searchPrimitives(bbox);
+        Assert.assertEquals("We should have found four items.", 4, result.size());
+    }
+
+    /**
      * Unit test of methods {@link DataSet#addChangeSetTag} / {@link DataSet#getChangeSetTags}.
      */
     @Test
