Index: src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java
===================================================================
--- src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java	(revision 15918)
+++ src/org/openstreetmap/josm/gui/mappaint/mapcss/Selector.java	(working copy)
@@ -439,7 +439,8 @@
                 if (right instanceof OptimizedGeneralSelector
                         && ((OptimizedGeneralSelector) right).matchesBase(OsmPrimitiveType.WAY)) {
                     final CrossingFinder crossingFinder = new CrossingFinder(e);
-                    crossingFinder.visit(e.osm.getDataSet().searchWays(e.osm.getBBox()));
+                    if (e.osm.getDataSet() != null)
+                        crossingFinder.visit(e.osm.getDataSet().searchWays(e.osm.getBBox()));
                 }
                 return e.children != null;
             } else if (ChildOrParentSelectorType.SIBLING == type) {
Index: test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java
===================================================================
--- test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java	(revision 15918)
+++ test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java	(working copy)
@@ -3,9 +3,14 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -16,7 +21,18 @@
 
 import org.junit.Rule;
 import org.junit.Test;
+import org.openstreetmap.josm.TestUtils;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.data.osm.Node;
+import org.openstreetmap.josm.data.osm.OsmDataManager;
+import org.openstreetmap.josm.data.osm.Way;
 import org.openstreetmap.josm.data.tagging.ac.AutoCompletionItem;
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.dialogs.properties.TagEditHelper.AddTagsDialog;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
+import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource;
 import org.openstreetmap.josm.testutils.JOSMTestRules;
 
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -65,4 +81,41 @@
         assertFalse(newTagEditHelper().containsDataKey("foo"));
         // TODO: complete test
     }
+
+    /**
+     * Non-regression test for <a
+     * href="https://josm.openstreetmap.de/ticket/18764>#18764</a>
+     *
+     * @throws InvocationTargetException Check logs -- if caused by NPE, a
+     *                                   regression probably occurred.
+     * @throws IllegalArgumentException  Check source code
+     * @throws IllegalAccessException    Check source code
+     * @throws NoSuchFieldException      Check source code
+     * @throws SecurityException         Probably shouldn't happen for tests
+     * @throws NoSuchMethodException     Check source code
+     */
+    @Test
+    public void testTicket18764() throws NoSuchMethodException, SecurityException, IllegalAccessException,
+            IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
+        MapCSSStyleSource css = new MapCSSStyleSource(
+                "*[building] ⧉ *[highway] { text: tr(\"Building crossing highway\"); }");
+        css.loadStyleSource();
+        MapPaintStyles.addStyle(css);
+        DataSet ds = new DataSet();
+        // This does require a way
+        Way way = TestUtils.newWay("", new Node(LatLon.NORTH_POLE), new Node(LatLon.SOUTH_POLE));
+        way.getNodes().forEach(ds::addPrimitive);
+        ds.addPrimitive(way);
+        OsmDataManager.getInstance().setActiveDataSet(ds);
+        MainApplication.getLayerManager().addLayer(new OsmDataLayer(ds, "Test Layer", null));
+        TagEditHelper helper = newTagEditHelper();
+        Field sel = TagEditHelper.class.getDeclaredField("sel");
+        sel.set(helper, Collections.singletonList(way));
+        AddTagsDialog addTagsDialog = helper.getAddTagsDialog();
+        Method findIcon = TagEditHelper.AbstractTagsDialog.class.getDeclaredMethod("findIcon", String.class,
+                String.class);
+        findIcon.setAccessible(true);
+        Object val = findIcon.invoke(addTagsDialog, "highway", "");
+        assertNotNull(val);
+    }
 }
